mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-24 18:11:39 -04:00
test: use sync operations for assertions (#7663)
This commit is contained in:
@@ -18,7 +18,7 @@ test('...', async t => {
|
||||
// ...
|
||||
const project = assertProject(t, pathToProject)
|
||||
|
||||
await project.has('foo')
|
||||
project.has('foo')
|
||||
// Test fails if project has no foo in node_modules
|
||||
})
|
||||
```
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
"@pnpm/types": "workspace:*",
|
||||
"is-windows": "^1.0.2",
|
||||
"isexe": "2.0.0",
|
||||
"path-exists": "^4.0.0",
|
||||
"read-yaml-file": "^2.1.0",
|
||||
"write-pkg": "4.0.0"
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { assertStore } from '@pnpm/assert-store'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { type LockfileFile } from '@pnpm/lockfile-types'
|
||||
import { type Modules, readModulesManifest } from '@pnpm/modules-yaml'
|
||||
import { type Modules } from '@pnpm/modules-yaml'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import readYamlFile from 'read-yaml-file'
|
||||
import exists from 'path-exists'
|
||||
import { sync as readYamlFile } from 'read-yaml-file'
|
||||
import writePkg from 'write-pkg'
|
||||
import isExecutable from './isExecutable'
|
||||
|
||||
@@ -15,30 +15,30 @@ export interface Project {
|
||||
// eslint-disable-next-line
|
||||
requireModule: (moduleName: string) => any
|
||||
dir: () => string
|
||||
has: (pkgName: string, modulesDir?: string) => Promise<void>
|
||||
hasNot: (pkgName: string, modulesDir?: string) => Promise<void>
|
||||
getStorePath: () => Promise<string>
|
||||
resolve: (pkgName: string, version?: string, relativePath?: string) => Promise<string>
|
||||
getPkgIndexFilePath: (pkgName: string, version?: string) => Promise<string>
|
||||
cafsHas: (pkgName: string, version?: string) => Promise<void>
|
||||
cafsHasNot: (pkgName: string, version?: string) => Promise<void>
|
||||
storeHas: (pkgName: string, version?: string) => Promise<string>
|
||||
storeHasNot: (pkgName: string, version?: string) => Promise<void>
|
||||
isExecutable: (pathToExe: string) => Promise<void>
|
||||
has: (pkgName: string, modulesDir?: string) => void
|
||||
hasNot: (pkgName: string, modulesDir?: string) => void
|
||||
getStorePath: () => string
|
||||
resolve: (pkgName: string, version?: string, relativePath?: string) => string
|
||||
getPkgIndexFilePath: (pkgName: string, version?: string) => string
|
||||
cafsHas: (pkgName: string, version?: string) => void
|
||||
cafsHasNot: (pkgName: string, version?: string) => void
|
||||
storeHas: (pkgName: string, version?: string) => string
|
||||
storeHasNot: (pkgName: string, version?: string) => void
|
||||
isExecutable: (pathToExe: string) => void
|
||||
/**
|
||||
* TODO: Remove the `Required<T>` cast.
|
||||
*
|
||||
* https://github.com/microsoft/TypeScript/pull/32695 might help with this.
|
||||
*/
|
||||
readCurrentLockfile: () => Promise<Required<LockfileFile>>
|
||||
readModulesManifest: () => Promise<Modules | null>
|
||||
readCurrentLockfile: () => Required<LockfileFile>
|
||||
readModulesManifest: () => Modules | null
|
||||
/**
|
||||
* TODO: Remove the `Required<T>` cast.
|
||||
*
|
||||
* https://github.com/microsoft/TypeScript/pull/32695 might help with this.
|
||||
*/
|
||||
readLockfile: (lockfileName?: string) => Promise<Required<LockfileFile>>
|
||||
writePackageJson: (pkgJson: object) => Promise<void>
|
||||
readLockfile: (lockfileName?: string) => Required<LockfileFile>
|
||||
writePackageJson: (pkgJson: object) => void
|
||||
}
|
||||
|
||||
export function assertProject (projectPath: string, encodedRegistryName?: string): Project {
|
||||
@@ -47,16 +47,16 @@ export function assertProject (projectPath: string, encodedRegistryName?: string
|
||||
|
||||
let cachedStore: {
|
||||
storePath: string
|
||||
getPkgIndexFilePath: (pkgName: string, version?: string) => Promise<string>
|
||||
cafsHas: (pkgName: string, version?: string | undefined) => Promise<void>
|
||||
cafsHasNot: (pkgName: string, version?: string | undefined) => Promise<void>
|
||||
storeHas: (pkgName: string, version?: string | undefined) => Promise<void>
|
||||
storeHasNot: (pkgName: string, version?: string | undefined) => Promise<void>
|
||||
resolve: (pkgName: string, version?: string | undefined, relativePath?: string | undefined) => Promise<string>
|
||||
getPkgIndexFilePath: (pkgName: string, version?: string) => string
|
||||
cafsHas: (pkgName: string, version?: string | undefined) => void
|
||||
cafsHasNot: (pkgName: string, version?: string | undefined) => void
|
||||
storeHas: (pkgName: string, version?: string | undefined) => void
|
||||
storeHasNot: (pkgName: string, version?: string | undefined) => void
|
||||
resolve: (pkgName: string, version?: string | undefined, relativePath?: string | undefined) => string
|
||||
}
|
||||
async function getStoreInstance () {
|
||||
function getStoreInstance () {
|
||||
if (!cachedStore) {
|
||||
const modulesYaml = await readModulesManifest(modules)
|
||||
const modulesYaml = readModulesManifest(modules)
|
||||
if (modulesYaml == null) {
|
||||
throw new Error(`Cannot find module store. No .modules.yaml found at "${modules}"`)
|
||||
}
|
||||
@@ -68,12 +68,15 @@ export function assertProject (projectPath: string, encodedRegistryName?: string
|
||||
}
|
||||
return cachedStore
|
||||
}
|
||||
async function getVirtualStoreDir () {
|
||||
const modulesYaml = await readModulesManifest(modules)
|
||||
function getVirtualStoreDir () {
|
||||
const modulesYaml = readModulesManifest(modules)
|
||||
if (modulesYaml == null) {
|
||||
return path.join(modules, '.pnpm')
|
||||
}
|
||||
return modulesYaml.virtualStoreDir
|
||||
if (path.isAbsolute(modulesYaml.virtualStoreDir)) {
|
||||
return modulesYaml.virtualStoreDir
|
||||
}
|
||||
return path.join(modules, modulesYaml.virtualStoreDir)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
@@ -86,42 +89,42 @@ export function assertProject (projectPath: string, encodedRegistryName?: string
|
||||
// eslint-disable-next-line
|
||||
return require(path.join(modules, pkgName))
|
||||
},
|
||||
async has (pkgName: string, _modulesDir?: string) {
|
||||
has (pkgName: string, _modulesDir?: string) {
|
||||
const md = _modulesDir ? path.join(projectPath, _modulesDir) : modules
|
||||
ok(await exists(path.join(md, pkgName)))
|
||||
ok(fs.existsSync(path.join(md, pkgName)))
|
||||
},
|
||||
async hasNot (pkgName: string, _modulesDir?: string) {
|
||||
hasNot (pkgName: string, _modulesDir?: string) {
|
||||
const md = _modulesDir ? path.join(projectPath, _modulesDir) : modules
|
||||
notOk(await exists(path.join(md, pkgName)))
|
||||
notOk(fs.existsSync(path.join(md, pkgName)))
|
||||
},
|
||||
async getStorePath () {
|
||||
const store = await getStoreInstance()
|
||||
getStorePath () {
|
||||
const store = getStoreInstance()
|
||||
return store.storePath
|
||||
},
|
||||
async resolve (pkgName: string, version?: string, relativePath?: string) {
|
||||
const store = await getStoreInstance()
|
||||
resolve (pkgName: string, version?: string, relativePath?: string) {
|
||||
const store = getStoreInstance()
|
||||
return store.resolve(pkgName, version, relativePath)
|
||||
},
|
||||
async getPkgIndexFilePath (pkgName: string, version?: string): Promise<string> {
|
||||
const store = await getStoreInstance()
|
||||
getPkgIndexFilePath (pkgName: string, version?: string): string {
|
||||
const store = getStoreInstance()
|
||||
return store.getPkgIndexFilePath(pkgName, version)
|
||||
},
|
||||
async cafsHas (pkgName: string, version?: string) {
|
||||
const store = await getStoreInstance()
|
||||
return store.cafsHas(pkgName, version)
|
||||
cafsHas (pkgName: string, version?: string) {
|
||||
const store = getStoreInstance()
|
||||
store.cafsHas(pkgName, version)
|
||||
},
|
||||
async cafsHasNot (pkgName: string, version?: string) {
|
||||
const store = await getStoreInstance()
|
||||
return store.cafsHasNot(pkgName, version)
|
||||
cafsHasNot (pkgName: string, version?: string) {
|
||||
const store = getStoreInstance()
|
||||
store.cafsHasNot(pkgName, version)
|
||||
},
|
||||
async storeHas (pkgName: string, version?: string) {
|
||||
const store = await getStoreInstance()
|
||||
storeHas (pkgName: string, version?: string) {
|
||||
const store = getStoreInstance()
|
||||
return store.resolve(pkgName, version)
|
||||
},
|
||||
async storeHasNot (pkgName: string, version?: string) {
|
||||
storeHasNot (pkgName: string, version?: string) {
|
||||
try {
|
||||
const store = await getStoreInstance()
|
||||
return store.storeHasNot(pkgName, version)
|
||||
const store = getStoreInstance()
|
||||
store.storeHasNot(pkgName, version)
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.message.startsWith('Cannot find module store')) {
|
||||
return
|
||||
@@ -129,28 +132,37 @@ export function assertProject (projectPath: string, encodedRegistryName?: string
|
||||
throw err
|
||||
}
|
||||
},
|
||||
async isExecutable (pathToExe: string) {
|
||||
return isExecutable(ok, path.join(modules, pathToExe))
|
||||
isExecutable (pathToExe: string) {
|
||||
isExecutable(ok, path.join(modules, pathToExe))
|
||||
},
|
||||
async readCurrentLockfile () {
|
||||
readCurrentLockfile () {
|
||||
try {
|
||||
return await readYamlFile(path.join(await getVirtualStoreDir(), 'lock.yaml'))
|
||||
return readYamlFile(path.join(getVirtualStoreDir(), 'lock.yaml'))
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.code === 'ENOENT') return null!
|
||||
throw err
|
||||
}
|
||||
},
|
||||
readModulesManifest: async () => readModulesManifest(modules),
|
||||
async readLockfile (lockfileName: string = WANTED_LOCKFILE) {
|
||||
readModulesManifest: () => readModulesManifest(modules),
|
||||
readLockfile (lockfileName: string = WANTED_LOCKFILE) {
|
||||
try {
|
||||
return await readYamlFile(path.join(projectPath, lockfileName))
|
||||
return readYamlFile(path.join(projectPath, lockfileName))
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.code === 'ENOENT') return null!
|
||||
throw err
|
||||
}
|
||||
},
|
||||
async writePackageJson (pkgJson: object) {
|
||||
return writePkg(projectPath, pkgJson as any) // eslint-disable-line
|
||||
writePackageJson (pkgJson: object) {
|
||||
writePkg.sync(projectPath, pkgJson as any) // eslint-disable-line
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function readModulesManifest (modulesDir: string) {
|
||||
try {
|
||||
return readYamlFile<Modules>(path.join(modulesDir, '.modules.yaml'))
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.code === 'ENOENT') return null!
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
import { promises as fs } from 'fs'
|
||||
import { promisify } from 'util'
|
||||
import fs from 'fs'
|
||||
import isWindows from 'is-windows'
|
||||
import isexeCB from 'isexe'
|
||||
import { sync as isexe } from 'isexe'
|
||||
|
||||
const IS_WINDOWS = isWindows()
|
||||
const isexe = promisify(isexeCB)
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default async (ok: (value: any, comment: string) => void, filePath: string) => {
|
||||
export default (ok: (value: any, comment: string) => void, filePath: string) => {
|
||||
if (IS_WINDOWS) {
|
||||
ok(await isexe(`${filePath}.cmd`), `${filePath}.cmd is executable`)
|
||||
ok(isexe(`${filePath}.cmd`), `${filePath}.cmd is executable`)
|
||||
return
|
||||
}
|
||||
|
||||
const stat = await fs.stat(filePath)
|
||||
const stat = fs.statSync(filePath)
|
||||
ok((stat.mode & 0o111) === 0o111, `${filePath} is executable`)
|
||||
ok(stat.isFile(), `${filePath} refers to a file`)
|
||||
}
|
||||
|
||||
@@ -5,20 +5,20 @@ import { assertProject } from '../src'
|
||||
test('assertProject()', async () => {
|
||||
const project = assertProject(path.join(__dirname, '../../..'))
|
||||
|
||||
await project.has('rimraf')
|
||||
await project.hasNot('sfdsff3g34') // cspell:disable-line
|
||||
project.has('rimraf')
|
||||
project.hasNot('sfdsff3g34') // cspell:disable-line
|
||||
expect(typeof project.requireModule('rimraf')).toBe('function')
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
})
|
||||
|
||||
test('assertProject() store functions', async () => {
|
||||
const project = assertProject(path.join(__dirname, 'fixture/project'), 'registry.npmjs.org')
|
||||
|
||||
expect(typeof await project.getStorePath()).toBe('string')
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
expect(typeof await project.resolve('is-positive', '3.1.0')).toBe('string')
|
||||
await project.storeHasNot('is-positive', '3.100.0')
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(typeof project.getStorePath()).toBe('string')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
expect(typeof project.resolve('is-positive', '3.1.0')).toBe('string')
|
||||
project.storeHasNot('is-positive', '3.100.0')
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { getFilePathInCafs } from '@pnpm/store.cafs'
|
||||
import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import exists from 'path-exists'
|
||||
|
||||
export function assertStore (
|
||||
storePath: string | Promise<string>,
|
||||
storePath: string,
|
||||
encodedRegistryName?: string
|
||||
) {
|
||||
// eslint-disable-next-line
|
||||
@@ -13,33 +13,33 @@ export function assertStore (
|
||||
const notOk = (value: any) => expect(value).toBeFalsy()
|
||||
const ern = encodedRegistryName ?? `localhost+${REGISTRY_MOCK_PORT}`
|
||||
const store = {
|
||||
async getPkgIndexFilePath (pkgName: string, version?: string): Promise<string> {
|
||||
const cafsDir = path.join(await storePath, 'files')
|
||||
getPkgIndexFilePath (pkgName: string, version?: string): string {
|
||||
const cafsDir = path.join(storePath, 'files')
|
||||
const integrity = version ? getIntegrity(pkgName, version) : pkgName
|
||||
return getFilePathInCafs(cafsDir, integrity, 'index')
|
||||
},
|
||||
async cafsHas (pkgName: string, version?: string): Promise<void> {
|
||||
const pathToCheck = await store.getPkgIndexFilePath(pkgName, version)
|
||||
ok(await exists(pathToCheck))
|
||||
cafsHas (pkgName: string, version?: string): void {
|
||||
const pathToCheck = store.getPkgIndexFilePath(pkgName, version)
|
||||
ok(fs.existsSync(pathToCheck))
|
||||
},
|
||||
async cafsHasNot (pkgName: string, version?: string): Promise<void> {
|
||||
const pathToCheck = await store.getPkgIndexFilePath(pkgName, version)
|
||||
notOk(await exists(pathToCheck))
|
||||
cafsHasNot (pkgName: string, version?: string): void {
|
||||
const pathToCheck = store.getPkgIndexFilePath(pkgName, version)
|
||||
notOk(fs.existsSync(pathToCheck))
|
||||
},
|
||||
async storeHas (pkgName: string, version?: string): Promise<void> {
|
||||
const pathToCheck = await store.resolve(pkgName, version)
|
||||
ok(await exists(pathToCheck))
|
||||
storeHas (pkgName: string, version?: string): void {
|
||||
const pathToCheck = store.resolve(pkgName, version)
|
||||
ok(fs.existsSync(pathToCheck))
|
||||
},
|
||||
async storeHasNot (pkgName: string, version?: string): Promise<void> {
|
||||
const pathToCheck = await store.resolve(pkgName, version)
|
||||
notOk(await exists(pathToCheck))
|
||||
storeHasNot (pkgName: string, version?: string): void {
|
||||
const pathToCheck = store.resolve(pkgName, version)
|
||||
notOk(fs.existsSync(pathToCheck))
|
||||
},
|
||||
async resolve (pkgName: string, version?: string, relativePath?: string): Promise<string> {
|
||||
resolve (pkgName: string, version?: string, relativePath?: string): string {
|
||||
const pkgFolder = version ? path.join(ern, pkgName, version) : pkgName
|
||||
if (relativePath) {
|
||||
return path.join(await storePath, pkgFolder, relativePath)
|
||||
return path.join(storePath, pkgFolder, relativePath)
|
||||
}
|
||||
return path.join(await storePath, pkgFolder)
|
||||
return path.join(storePath, pkgFolder)
|
||||
},
|
||||
}
|
||||
return store
|
||||
|
||||
@@ -7,9 +7,9 @@ test('assertStore() store assertions', async () => {
|
||||
const encodedRegistryName = 'registry.npmjs.org'
|
||||
const store = assertStore(storePath, encodedRegistryName)
|
||||
|
||||
await store.storeHas('is-positive', '3.1.0')
|
||||
await store.storeHasNot('ansi-regex', '2.0.0')
|
||||
await store.storeHasNot('is-positive', '2.0.0')
|
||||
store.storeHas('is-positive', '3.1.0')
|
||||
store.storeHasNot('ansi-regex', '2.0.0')
|
||||
store.storeHasNot('is-positive', '2.0.0')
|
||||
})
|
||||
|
||||
test('assertStore() resolve', async () => {
|
||||
@@ -17,5 +17,5 @@ test('assertStore() resolve', async () => {
|
||||
const encodedRegistryName = 'registry.npmjs.org'
|
||||
const store = assertStore(storePath, encodedRegistryName)
|
||||
|
||||
expect(typeof await store.resolve('is-positive', '3.1.0')).toBe('string')
|
||||
expect(typeof store.resolve('is-positive', '3.1.0')).toBe('string')
|
||||
})
|
||||
|
||||
@@ -35,13 +35,13 @@ test('rebuilds dependencies', async () => {
|
||||
`--cache-dir=${cacheDir}`,
|
||||
])
|
||||
|
||||
let modules = await project.readModulesManifest()
|
||||
let modules = project.readModulesManifest()
|
||||
expect(modules!.pendingBuilds).toStrictEqual([
|
||||
'/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
'github.com/pnpm/test-git-fetch/299c6d89507571462b992b92407a8a07663e32ee',
|
||||
])
|
||||
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -51,7 +51,7 @@ test('rebuilds dependencies', async () => {
|
||||
storeDir,
|
||||
}, [])
|
||||
|
||||
modules = await project.readModulesManifest()
|
||||
modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).toBe(0)
|
||||
|
||||
@@ -109,12 +109,12 @@ test('skipIfHasSideEffectsCache', async () => {
|
||||
}
|
||||
fs.writeFileSync(cacheIntegrityPath, JSON.stringify(cacheIntegrity, null, 2), 'utf8')
|
||||
|
||||
let modules = await project.readModulesManifest()
|
||||
let modules = project.readModulesManifest()
|
||||
expect(modules!.pendingBuilds).toStrictEqual([
|
||||
'/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
])
|
||||
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -125,7 +125,7 @@ test('skipIfHasSideEffectsCache', async () => {
|
||||
storeDir,
|
||||
}, [])
|
||||
|
||||
modules = await project.readModulesManifest()
|
||||
modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).toBe(0)
|
||||
|
||||
@@ -151,7 +151,7 @@ test('rebuild does not fail when a linked package is present', async () => {
|
||||
'--ignore-scripts',
|
||||
])
|
||||
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -180,7 +180,7 @@ test('rebuilds specific dependencies', async () => {
|
||||
'--ignore-scripts',
|
||||
])
|
||||
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -190,8 +190,8 @@ test('rebuilds specific dependencies', async () => {
|
||||
storeDir,
|
||||
}, ['install-scripts-example-for-pnpm'])
|
||||
|
||||
await project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall')
|
||||
await project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall')
|
||||
project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall')
|
||||
project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall')
|
||||
|
||||
const generatedByPreinstall = project.requireModule('install-scripts-example-for-pnpm/generated-by-preinstall')
|
||||
expect(typeof generatedByPreinstall).toBe('function')
|
||||
@@ -223,17 +223,17 @@ test('rebuild with pending option', async () => {
|
||||
'--ignore-scripts',
|
||||
])
|
||||
|
||||
let modules = await project.readModulesManifest()
|
||||
let modules = project.readModulesManifest()
|
||||
expect(modules!.pendingBuilds).toStrictEqual([
|
||||
'/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
'github.com/pnpm-e2e/install-scripts-example/b6cfdb8af6f8d5ebc5e7de6831af9d38084d765b',
|
||||
])
|
||||
|
||||
await project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall')
|
||||
await project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall')
|
||||
project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall')
|
||||
project.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall')
|
||||
|
||||
await project.hasNot('install-scripts-example-for-pnpm/generated-by-preinstall')
|
||||
await project.hasNot('install-scripts-example-for-pnpm/generated-by-postinstall')
|
||||
project.hasNot('install-scripts-example-for-pnpm/generated-by-preinstall')
|
||||
project.hasNot('install-scripts-example-for-pnpm/generated-by-postinstall')
|
||||
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
@@ -244,7 +244,7 @@ test('rebuild with pending option', async () => {
|
||||
storeDir,
|
||||
}, [])
|
||||
|
||||
modules = await project.readModulesManifest()
|
||||
modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).toBe(0)
|
||||
|
||||
@@ -280,12 +280,12 @@ test('rebuild dependencies in correct order', async () => {
|
||||
'--ignore-scripts',
|
||||
])
|
||||
|
||||
let modules = await project.readModulesManifest()
|
||||
let modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).not.toBe(0)
|
||||
|
||||
await project.hasNot('.pnpm/@pnpm.e2e+with-postinstall-b@1.0.0/node_modules/@pnpm.e2e/with-postinstall-b/output.json')
|
||||
await project.hasNot('@pnpm.e2e/with-postinstall-a/output.json')
|
||||
project.hasNot('.pnpm/@pnpm.e2e+with-postinstall-b@1.0.0/node_modules/@pnpm.e2e/with-postinstall-b/output.json')
|
||||
project.hasNot('@pnpm.e2e/with-postinstall-a/output.json')
|
||||
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
@@ -296,7 +296,7 @@ test('rebuild dependencies in correct order', async () => {
|
||||
storeDir,
|
||||
}, [])
|
||||
|
||||
modules = await project.readModulesManifest()
|
||||
modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).toBe(0)
|
||||
|
||||
@@ -326,7 +326,7 @@ test('rebuild links bins', async () => {
|
||||
expect(await exists(path.resolve('node_modules/@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd1'))).toBeFalsy()
|
||||
expect(await exists(path.resolve('node_modules/@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd2'))).toBeFalsy()
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -336,10 +336,10 @@ test('rebuild links bins', async () => {
|
||||
storeDir,
|
||||
}, [])
|
||||
|
||||
await project.isExecutable('.bin/cmd1')
|
||||
await project.isExecutable('.bin/cmd2')
|
||||
await project.isExecutable('@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd1')
|
||||
await project.isExecutable('@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd2')
|
||||
project.isExecutable('.bin/cmd1')
|
||||
project.isExecutable('.bin/cmd2')
|
||||
project.isExecutable('@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd1')
|
||||
project.isExecutable('@pnpm.e2e/has-generated-bins-as-dep/node_modules/.bin/cmd2')
|
||||
})
|
||||
|
||||
test(`rebuild should not fail on incomplete ${WANTED_LOCKFILE}`, async () => {
|
||||
@@ -365,7 +365,7 @@ test(`rebuild should not fail on incomplete ${WANTED_LOCKFILE}`, async () => {
|
||||
|
||||
const reporter = sinon.spy()
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -392,7 +392,7 @@ test('never build neverBuiltDependencies', async () => {
|
||||
`--cache-dir=${cacheDir}`,
|
||||
])
|
||||
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
await rebuild.handler(
|
||||
{
|
||||
...DEFAULT_OPTS,
|
||||
|
||||
@@ -43,12 +43,12 @@ test('pnpm recursive rebuild', async () => {
|
||||
'--reporter=append-only',
|
||||
], { stdout: 'inherit' })
|
||||
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
|
||||
const modulesManifest = await projects['project-1'].readModulesManifest()
|
||||
const modulesManifest = projects['project-1'].readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
allProjects,
|
||||
@@ -59,10 +59,10 @@ test('pnpm recursive rebuild', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
}, [])
|
||||
|
||||
await projects['project-1'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
})
|
||||
|
||||
test('pnpm recursive rebuild with hoisted node linker', async () => {
|
||||
@@ -116,14 +116,14 @@ test('pnpm recursive rebuild with hoisted node linker', async () => {
|
||||
], { stdout: 'inherit' })
|
||||
|
||||
const rootProject = assertProject(process.cwd())
|
||||
await rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
|
||||
const modulesManifest = await rootProject.readModulesManifest()
|
||||
const modulesManifest = rootProject.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
allProjects,
|
||||
@@ -136,16 +136,16 @@ test('pnpm recursive rebuild with hoisted node linker', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
}, [])
|
||||
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
})
|
||||
|
||||
test('rebuild multiple packages in correct order', async () => {
|
||||
@@ -258,26 +258,26 @@ test('never build neverBuiltDependencies', async () => {
|
||||
],
|
||||
{ stdout: 'inherit' }
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
|
||||
const modulesManifest = await projects['project-1'].readModulesManifest()
|
||||
const modulesManifest = projects['project-1'].readModulesManifest()
|
||||
await rebuild.handler(
|
||||
{
|
||||
...DEFAULT_OPTS,
|
||||
@@ -292,22 +292,22 @@ test('never build neverBuiltDependencies', async () => {
|
||||
[]
|
||||
)
|
||||
|
||||
await projects['project-1'].has(
|
||||
projects['project-1'].has(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-2'].has(
|
||||
projects['project-2'].has(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
})
|
||||
@@ -352,26 +352,26 @@ test('only build onlyBuiltDependencies', async () => {
|
||||
],
|
||||
{ stdout: 'inherit' }
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
|
||||
const modulesManifest = await projects['project-1'].readModulesManifest()
|
||||
const modulesManifest = projects['project-1'].readModulesManifest()
|
||||
await rebuild.handler(
|
||||
{
|
||||
...DEFAULT_OPTS,
|
||||
@@ -386,22 +386,22 @@ test('only build onlyBuiltDependencies', async () => {
|
||||
[]
|
||||
)
|
||||
|
||||
await projects['project-1'].hasNot(
|
||||
projects['project-1'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-2'].hasNot(
|
||||
projects['project-2'].hasNot(
|
||||
'@pnpm.e2e/install-script-example/generated-by-install.js'
|
||||
)
|
||||
await projects['project-1'].has(
|
||||
projects['project-1'].has(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-1'].has(
|
||||
projects['project-1'].has(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
await projects['project-2'].has(
|
||||
projects['project-2'].has(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js'
|
||||
)
|
||||
await projects['project-2'].has(
|
||||
projects['project-2'].has(
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js'
|
||||
)
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ test('installation breaks if the lockfile contains the wrong checksum', async ()
|
||||
await testDefaults({ lockfileOnly: true })
|
||||
)
|
||||
|
||||
const corruptedLockfile = await project.readLockfile()
|
||||
const corruptedLockfile = project.readLockfile()
|
||||
const correctLockfile = clone(corruptedLockfile)
|
||||
// breaking the lockfile
|
||||
;(corruptedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity = (corruptedLockfile.packages['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity
|
||||
@@ -40,7 +40,7 @@ test('installation breaks if the lockfile contains the wrong checksum', async ()
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults())
|
||||
|
||||
expect(await project.readLockfile()).toStrictEqual(correctLockfile)
|
||||
expect(project.readLockfile()).toStrictEqual(correctLockfile)
|
||||
|
||||
// Breaking the lockfile again
|
||||
await writeYamlFile(WANTED_LOCKFILE, corruptedLockfile, { lineWidth: 1000 })
|
||||
@@ -53,7 +53,7 @@ test('installation breaks if the lockfile contains the wrong checksum', async ()
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ preferFrozenLockfile: false }))
|
||||
|
||||
expect(await project.readLockfile()).toStrictEqual(correctLockfile)
|
||||
expect(project.readLockfile()).toStrictEqual(correctLockfile)
|
||||
})
|
||||
|
||||
test('installation breaks if the lockfile contains the wrong checksum and the store is clean', async () => {
|
||||
@@ -67,7 +67,7 @@ test('installation breaks if the lockfile contains the wrong checksum and the st
|
||||
await testDefaults({ lockfileOnly: true })
|
||||
)
|
||||
|
||||
const corruptedLockfile = await project.readLockfile()
|
||||
const corruptedLockfile = project.readLockfile()
|
||||
const correctIntegrity = (corruptedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity
|
||||
// breaking the lockfile
|
||||
;(corruptedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity = 'sha512-pl8WtlGAnoIQ7gPxT187/YwhKRnsFBR4h0YY+v0FPQjT5WPuZbI9dPRaKWgKBFOqWHylJ8EyPy34V5u9YArfng=='
|
||||
@@ -88,7 +88,7 @@ test('installation breaks if the lockfile contains the wrong checksum and the st
|
||||
}, await testDefaults({}, { retry: { retries: 0 } }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect((lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity).toBe(correctIntegrity)
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ test('installation breaks if the lockfile contains the wrong checksum and the st
|
||||
message: expect.stringMatching(/Got unexpected checksum/),
|
||||
}))
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect((lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).integrity).toBe(correctIntegrity)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,13 +12,13 @@ test('should fail to update when requests are cached', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], opts)
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' })
|
||||
|
||||
await install(manifest, { ...opts, depth: 1, update: true })
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('should not cache when cache is not used', async () => {
|
||||
@@ -28,11 +28,11 @@ test('should not cache when cache is not used', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults({ save: true }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' })
|
||||
|
||||
await install(manifest, await testDefaults({ depth: 1, update: true }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ test('overwriting (is-positive@3.0.0 with is-positive@latest)', async () => {
|
||||
await testDefaults({ nodeLinker: 'hoisted', save: true })
|
||||
)
|
||||
|
||||
await project.storeHas('is-positive', '3.0.0')
|
||||
project.storeHas('is-positive', '3.0.0')
|
||||
|
||||
const updatedManifest = await addDependenciesToPackage(
|
||||
manifest,
|
||||
@@ -70,7 +70,7 @@ test('overwriting (is-positive@3.0.0 with is-positive@latest)', async () => {
|
||||
await testDefaults({ nodeLinker: 'hoisted', save: true })
|
||||
)
|
||||
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
expect(updatedManifest.dependencies?.['is-positive']).toBe('3.1.0')
|
||||
expect(loadJsonFile<{ version: string }>('node_modules/is-positive/package.json').version).toBe('3.1.0')
|
||||
})
|
||||
|
||||
@@ -64,9 +64,9 @@ test('uninstall package with no dependencies', async () => {
|
||||
|
||||
// uninstall does not remove packages from store
|
||||
// even if they become unreferenced
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
|
||||
await project.hasNot('is-negative')
|
||||
project.hasNot('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -85,21 +85,21 @@ test('uninstall package with dependencies and do not touch other deps', async ()
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ nodeLinker: 'hoisted', pruneStore: true, save: true }))).manifest
|
||||
|
||||
await project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
await project.hasNot('camelcase-keys')
|
||||
project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
project.hasNot('camelcase-keys')
|
||||
|
||||
await project.storeHasNot('camelcase', '3.0.0')
|
||||
await project.hasNot('camelcase')
|
||||
project.storeHasNot('camelcase', '3.0.0')
|
||||
project.hasNot('camelcase')
|
||||
|
||||
await project.storeHasNot('map-obj', '1.0.1')
|
||||
await project.hasNot('map-obj')
|
||||
project.storeHasNot('map-obj', '1.0.1')
|
||||
project.hasNot('map-obj')
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
await project.has('is-negative')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
project.has('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'is-negative': '2.1.0' })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'is-negative': {
|
||||
specifier: '2.1.0',
|
||||
|
||||
@@ -12,7 +12,7 @@ test('installing aliased dependency', async () => {
|
||||
expect(typeof m).toBe('function')
|
||||
expect(typeof project.requireModule('positive')).toBe('function')
|
||||
|
||||
expect(await project.readLockfile()).toStrictEqual({
|
||||
expect(project.readLockfile()).toStrictEqual({
|
||||
settings: {
|
||||
autoInstallPeers: true,
|
||||
excludeLinksFromLockfile: false,
|
||||
@@ -61,7 +61,7 @@ test('aliased dependency w/o version spec, with custom tag config', async () =>
|
||||
|
||||
await addDependenciesToPackage({}, ['foo@npm:@pnpm.e2e/dep-of-pkg-with-1-dep'], await testDefaults({ tag }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('a dependency has an aliased subdependency', async () => {
|
||||
@@ -73,7 +73,7 @@ test('a dependency has an aliased subdependency', async () => {
|
||||
|
||||
expect(project.requireModule('@pnpm.e2e/pkg-with-1-aliased-dep')().name).toEqual('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
expect(await project.readLockfile()).toStrictEqual({
|
||||
expect(project.readLockfile()).toStrictEqual({
|
||||
settings: {
|
||||
autoInstallPeers: true,
|
||||
excludeLinksFromLockfile: false,
|
||||
|
||||
@@ -26,7 +26,7 @@ test('a package that need authentication', async () => {
|
||||
authConfig,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
|
||||
// should work when a lockfile is available
|
||||
// and the registry in .npmrc is not the same as the one in lockfile
|
||||
@@ -44,7 +44,7 @@ test('a package that need authentication', async () => {
|
||||
authConfig,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
})
|
||||
|
||||
test('installing a package that need authentication, using password', async () => {
|
||||
@@ -68,7 +68,7 @@ test('installing a package that need authentication, using password', async () =
|
||||
authConfig,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
})
|
||||
|
||||
test('a package that need authentication, legacy way', async () => {
|
||||
@@ -90,7 +90,7 @@ test('a package that need authentication, legacy way', async () => {
|
||||
authConfig,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
})
|
||||
|
||||
test('a scoped package that need authentication specific to scope', async () => {
|
||||
@@ -115,7 +115,7 @@ test('a scoped package that need authentication specific to scope', async () =>
|
||||
})
|
||||
const manifest = await addDependenciesToPackage({}, ['@private/foo'], opts)
|
||||
|
||||
await project.has('@private/foo')
|
||||
project.has('@private/foo')
|
||||
|
||||
// should work when a lockfile is available
|
||||
await rimraf('node_modules')
|
||||
@@ -130,7 +130,7 @@ test('a scoped package that need authentication specific to scope', async () =>
|
||||
})
|
||||
await addDependenciesToPackage(manifest, ['@private/foo'], opts)
|
||||
|
||||
await project.has('@private/foo')
|
||||
project.has('@private/foo')
|
||||
})
|
||||
|
||||
test('a scoped package that need legacy authentication specific to scope', async () => {
|
||||
@@ -155,7 +155,7 @@ test('a scoped package that need legacy authentication specific to scope', async
|
||||
})
|
||||
const manifest = await addDependenciesToPackage({}, ['@private/foo'], opts)
|
||||
|
||||
await project.has('@private/foo')
|
||||
project.has('@private/foo')
|
||||
|
||||
// should work when a lockfile is available
|
||||
await rimraf('node_modules')
|
||||
@@ -170,7 +170,7 @@ test('a scoped package that need legacy authentication specific to scope', async
|
||||
})
|
||||
await addDependenciesToPackage(manifest, ['@private/foo'], opts)
|
||||
|
||||
await project.has('@private/foo')
|
||||
project.has('@private/foo')
|
||||
})
|
||||
|
||||
skipOnNode17('a package that need authentication reuses authorization tokens for tarball fetching', async () => {
|
||||
@@ -197,7 +197,7 @@ skipOnNode17('a package that need authentication reuses authorization tokens for
|
||||
authConfig,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
})
|
||||
|
||||
skipOnNode17('a package that need authentication reuses authorization tokens for tarball fetching when meta info is cached', async () => {
|
||||
@@ -243,5 +243,5 @@ skipOnNode17('a package that need authentication reuses authorization tokens for
|
||||
})
|
||||
await install(manifest, opts)
|
||||
|
||||
await project.has('@pnpm.e2e/needs-auth')
|
||||
project.has('@pnpm.e2e/needs-auth')
|
||||
})
|
||||
|
||||
@@ -11,19 +11,19 @@ test('auto install non-optional peer dependencies', async () => {
|
||||
await addDistTag({ package: '@pnpm.e2e/peer-a', version: '1.0.0', distTag: 'latest' })
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/abc-optional-peers@1.0.0'], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/abc-optional-peers@1.0.0(@pnpm.e2e/peer-a@1.0.0)',
|
||||
'/@pnpm.e2e/peer-a@1.0.0',
|
||||
])
|
||||
await project.hasNot('@pnpm.e2e/peer-a')
|
||||
project.hasNot('@pnpm.e2e/peer-a')
|
||||
})
|
||||
|
||||
test('auto install the common peer dependency', async () => {
|
||||
await addDistTag({ package: '@pnpm.e2e/peer-c', version: '1.0.1', distTag: 'latest' })
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/wants-peer-c-1', '@pnpm.e2e/wants-peer-c-1.0.0'], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/peer-c@1.0.0',
|
||||
'/@pnpm.e2e/wants-peer-c-1.0.0@1.0.0(@pnpm.e2e/peer-c@1.0.0)',
|
||||
@@ -34,7 +34,7 @@ test('auto install the common peer dependency', async () => {
|
||||
test('do not auto install when there is no common peer dependency range intersection', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/wants-peer-c-1', '@pnpm.e2e/wants-peer-c-2'], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/wants-peer-c-1@1.0.0',
|
||||
'/@pnpm.e2e/wants-peer-c-2@1.0.0',
|
||||
@@ -48,7 +48,7 @@ test('auto install latest when there is no common peer dependency range intersec
|
||||
autoInstallPeers: true,
|
||||
autoInstallPeersFromHighestMatch: true,
|
||||
}))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/peer-c@2.0.0',
|
||||
'/@pnpm.e2e/wants-peer-c-1@1.0.0(@pnpm.e2e/peer-c@2.0.0)',
|
||||
@@ -85,7 +85,7 @@ test('don\'t fail on linked package, when peers are auto installed', async () =>
|
||||
test('hoist a peer dependency in order to reuse it by other dependencies, when it satisfies them', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm/xyz-parent-parent-parent-parent', '@pnpm/xyz-parent-parent-with-xyz'], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const suffix = createPeersDirSuffix([{ name: '@pnpm/x', version: '1.0.0' }, { name: '@pnpm/y', version: '1.0.0' }, { name: '@pnpm/z', version: '1.0.0' }])
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm/x@1.0.0',
|
||||
@@ -108,7 +108,7 @@ test('don\'t hoist a peer dependency when there is a root dependency by that nam
|
||||
'@pnpm/x@npm:@pnpm.e2e/peer-a@1.0.0',
|
||||
`http://localhost:${REGISTRY_MOCK_PORT}/@pnpm/y/-/y-2.0.0.tgz`,
|
||||
], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const suffix1 = createPeersDirSuffix([{ name: '@pnpm/y', version: '2.0.0' }, { name: '@pnpm/z', version: '1.0.0' }, { name: '@pnpm.e2e/peer-a', version: '1.0.0' }])
|
||||
const suffix2 = createPeersDirSuffix([{ name: '@pnpm/x', version: '1.0.0' }, { name: '@pnpm/y', version: '1.0.0' }, { name: '@pnpm/z', version: '1.0.0' }])
|
||||
expect(Object.keys(lockfile.packages).sort()).toStrictEqual([
|
||||
@@ -135,7 +135,7 @@ test('don\'t auto-install a peer dependency, when that dependency is in the root
|
||||
'@pnpm/x@npm:@pnpm.e2e/peer-a@1.0.0',
|
||||
`http://localhost:${REGISTRY_MOCK_PORT}/@pnpm/y/-/y-2.0.0.tgz`,
|
||||
], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const suffix = createPeersDirSuffix([{ name: '@pnpm/y', version: '2.0.0' }, { name: '@pnpm/z', version: '1.0.0' }, { name: '@pnpm.e2e/peer-a', version: '1.0.0' }])
|
||||
expect(Object.keys(lockfile.packages).sort()).toStrictEqual([
|
||||
`/@pnpm/xyz-parent-parent-parent-parent@1.0.0${suffix}`,
|
||||
@@ -155,7 +155,7 @@ test('don\'t install the same missing peer dependency twice', async () => {
|
||||
await addDependenciesToPackage({}, [
|
||||
'@pnpm.e2e/has-has-y-peer-peer',
|
||||
], await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages).sort()).toStrictEqual([
|
||||
'/@pnpm/y@1.0.0',
|
||||
'/@pnpm.e2e/has-has-y-peer-peer@1.0.0(@pnpm.e2e/has-y-peer@1.0.0(@pnpm/y@1.0.0))(@pnpm/y@1.0.0)',
|
||||
@@ -173,7 +173,7 @@ test('prefer the peer dependency version already used in the root', async () =>
|
||||
'@pnpm/y': '^1.0.0',
|
||||
},
|
||||
}, await testDefaults({ autoInstallPeers: true }))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages).sort()).toStrictEqual([
|
||||
'/@pnpm/y@1.0.0',
|
||||
'/@pnpm.e2e/has-y-peer@1.0.0(@pnpm/y@1.0.0)',
|
||||
@@ -192,11 +192,11 @@ test('automatically install root peer dependencies', async () => {
|
||||
},
|
||||
}, await testDefaults({ autoInstallPeers: true, resolutionMode: 'lowest-direct' }))
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
project.has('is-positive')
|
||||
project.has('is-negative')
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'is-positive': {
|
||||
specifier: '^1.0.0',
|
||||
@@ -214,17 +214,17 @@ test('automatically install root peer dependencies', async () => {
|
||||
|
||||
await install(manifest, await testDefaults({ autoInstallPeers: true, frozenLockfile: true }))
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
project.has('is-positive')
|
||||
project.has('is-negative')
|
||||
|
||||
// The auto installed peer is not removed when a new dependency is added
|
||||
manifest = await addDependenciesToPackage(manifest, ['is-odd@1.0.0'], await testDefaults({ autoInstallPeers: true, resolutionMode: 'lowest-direct' }))
|
||||
await project.has('is-odd')
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
project.has('is-odd')
|
||||
project.has('is-positive')
|
||||
project.has('is-negative')
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'is-odd': {
|
||||
specifier: '1.0.0',
|
||||
@@ -248,12 +248,12 @@ test('automatically install root peer dependencies', async () => {
|
||||
mutation: 'uninstallSome',
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ autoInstallPeers: true, resolutionMode: 'lowest-direct' }))
|
||||
await project.hasNot('is-odd')
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
project.hasNot('is-odd')
|
||||
project.has('is-positive')
|
||||
project.has('is-negative')
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'is-positive': {
|
||||
specifier: '^1.0.0',
|
||||
@@ -306,7 +306,7 @@ test('automatically install peer dependency when it is a dev dependency in anoth
|
||||
}))
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.importers['project-1'].devDependencies).toStrictEqual({
|
||||
'is-positive': {
|
||||
specifier: '1.0.0',
|
||||
@@ -599,6 +599,6 @@ test('do not override the direct dependency with an auto installed peer dependen
|
||||
],
|
||||
},
|
||||
}))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies.rxjs.version).toStrictEqual('6.6.7')
|
||||
})
|
||||
|
||||
@@ -10,9 +10,9 @@ test('bundledDependencies (pkg-with-bundled-dependencies@1.0.0)', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-bundled-dependencies@1.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.isExecutable('@pnpm.e2e/pkg-with-bundled-dependencies/node_modules/.bin/hello-world-js-bin')
|
||||
project.isExecutable('@pnpm.e2e/pkg-with-bundled-dependencies/node_modules/.bin/hello-world-js-bin')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
lockfile.packages['/@pnpm.e2e/pkg-with-bundled-dependencies@1.0.0'].bundledDependencies
|
||||
).toStrictEqual(
|
||||
@@ -31,7 +31,7 @@ test('local tarball with bundledDependencies', async () => {
|
||||
f.copy('pkg-with-bundled-dependencies/pkg-with-bundled-dependencies-1.0.0.tgz', 'pkg.tgz')
|
||||
await addDependenciesToPackage({}, ['file:pkg.tgz'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
lockfile.packages['file:pkg.tgz'].bundledDependencies
|
||||
).toStrictEqual(
|
||||
@@ -48,7 +48,7 @@ test('local tarball with bundledDependencies true', async () => {
|
||||
f.copy('pkg-with-bundle-dependencies-true/pkg-with-bundle-dependencies-true-1.0.0.tgz', 'pkg.tgz')
|
||||
await addDependenciesToPackage({}, ['file:pkg.tgz'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
lockfile.packages['file:pkg.tgz'].bundledDependencies
|
||||
).toStrictEqual(
|
||||
@@ -64,9 +64,9 @@ test('bundleDependencies (pkg-with-bundle-dependencies@1.0.0)', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-bundle-dependencies@1.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.isExecutable('@pnpm.e2e/pkg-with-bundle-dependencies/node_modules/.bin/hello-world-js-bin')
|
||||
project.isExecutable('@pnpm.e2e/pkg-with-bundle-dependencies/node_modules/.bin/hello-world-js-bin')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
lockfile.packages['/@pnpm.e2e/pkg-with-bundle-dependencies@1.0.0'].bundledDependencies
|
||||
).toStrictEqual(
|
||||
@@ -82,7 +82,7 @@ test('installing a package with bundleDependencies set to false (pkg-with-bundle
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-bundle-dependencies-false'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
typeof lockfile.packages['/@pnpm.e2e/pkg-with-bundle-dependencies-false@1.0.0'].bundledDependencies
|
||||
).toEqual('undefined')
|
||||
@@ -93,7 +93,7 @@ test('installing a package with bundleDependencies set to true (pkg-with-bundle-
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-bundle-dependencies-true@1.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(
|
||||
lockfile.packages['/@pnpm.e2e/hello-world-js-bin@1.0.0']
|
||||
|
||||
@@ -18,7 +18,7 @@ test('prefer version ranges specified for top dependencies', async () => {
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -38,7 +38,7 @@ test('prefer version ranges specified for top dependencies, when doing named ins
|
||||
)
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -58,7 +58,7 @@ test('prefer version ranges specified for top dependencies, even if they are ali
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -78,7 +78,7 @@ test('prefer version ranges specified for top dependencies, even if the subdepen
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -98,7 +98,7 @@ test('ignore version of root dependency when it is incompatible with the indirec
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@101.0.0'])
|
||||
})
|
||||
@@ -119,7 +119,7 @@ test('prefer dist-tag specified for top dependency', async () => {
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -147,7 +147,7 @@ test('prefer version ranges passed in via opts.preferredVersions', async () => {
|
||||
)
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -163,7 +163,7 @@ test('prefer version of package that also satisfies the range of the same packag
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(
|
||||
Object.keys(lockfile.packages)
|
||||
@@ -187,7 +187,7 @@ test('dedupe subdependency when a newer version of the same package is installed
|
||||
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
})
|
||||
@@ -206,7 +206,7 @@ test('when resolving dependencies, prefer versions that are used by direct depen
|
||||
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/has-foo-100.0.0-range-dep'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/has-foo-100.0.0-range-dep@1.0.0']).toHaveProperty(['dependencies', '@pnpm.e2e/foo'], '100.0.0')
|
||||
})
|
||||
|
||||
@@ -224,6 +224,6 @@ test('when resolving dependencies, prefer versions that are used by direct depen
|
||||
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/has-foo-100.0.0-range-dep'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/has-foo-100.0.0-range-dep@1.0.0']).toHaveProperty(['dependencies', '@pnpm.e2e/foo'], '100.0.0')
|
||||
})
|
||||
|
||||
@@ -77,8 +77,8 @@ test('dedupe direct dependencies', async () => {
|
||||
},
|
||||
]
|
||||
await mutateModules(importers, await testDefaults({ allProjects, dedupeDirectDeps: true }))
|
||||
await projects['project-2'].has('@pnpm.e2e/hello-world-js-bin')
|
||||
await projects['project-3'].has('@pnpm.e2e/hello-world-js-bin')
|
||||
projects['project-2'].has('@pnpm.e2e/hello-world-js-bin')
|
||||
projects['project-3'].has('@pnpm.e2e/hello-world-js-bin')
|
||||
|
||||
allProjects[0].manifest.dependencies['@pnpm.e2e/hello-world-js-bin'] = '1.0.0'
|
||||
allProjects[1].manifest.dependencies['is-positive'] = '1.0.0'
|
||||
@@ -96,13 +96,13 @@ test('dedupe direct dependencies', async () => {
|
||||
])
|
||||
expect(Array.from(fs.readdirSync('node_modules/@pnpm.e2e'))).toEqual(['hello-world-js-bin'])
|
||||
expect(fs.readdirSync('project-2/node_modules').sort()).toEqual(['is-odd'])
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/hello-world-js-bin')
|
||||
projects['project-3'].hasNot('@pnpm.e2e/hello-world-js-bin')
|
||||
expect(fs.existsSync('project-3/node_modules')).toBeFalsy()
|
||||
|
||||
// Test the same with headless install
|
||||
await mutateModules(importers, await testDefaults({ allProjects, dedupeDirectDeps: true, frozenLockfile: true }))
|
||||
expect(fs.readdirSync('project-2/node_modules').sort()).toEqual(['is-odd'])
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/hello-world-js-bin')
|
||||
projects['project-3'].hasNot('@pnpm.e2e/hello-world-js-bin')
|
||||
expect(fs.existsSync('project-3/node_modules')).toBeFalsy()
|
||||
})
|
||||
|
||||
@@ -160,8 +160,8 @@ test('dedupe direct dependencies after public hoisting', async () => {
|
||||
publicHoistPattern: ['@pnpm.e2e/dep-of-pkg-with-1-dep'],
|
||||
})
|
||||
await mutateModules(importers, opts)
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
expect(Array.from(fs.readdirSync('node_modules/@pnpm.e2e').sort())).toEqual([
|
||||
'dep-of-pkg-with-1-dep',
|
||||
'pkg-with-1-dep',
|
||||
@@ -171,8 +171,8 @@ test('dedupe direct dependencies after public hoisting', async () => {
|
||||
// Test the same with headless install
|
||||
await rimraf('node_modules')
|
||||
await mutateModules(importers, { ...opts, frozenLockfile: true })
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
expect(Array.from(fs.readdirSync('node_modules/@pnpm.e2e').sort())).toEqual([
|
||||
'dep-of-pkg-with-1-dep',
|
||||
'pkg-with-1-dep',
|
||||
|
||||
@@ -57,7 +57,7 @@ test('pick common range for a dependency used in two workspace projects when res
|
||||
await mutateModules(importers, await testDefaults({ allProjects, lockfileOnly: true, resolutionMode: 'highest' }))
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
@@ -114,7 +114,7 @@ test('pick common range for a dependency used in two workspace projects when res
|
||||
await mutateModules(importers, await testDefaults({ allProjects, lockfileOnly: true, resolutionMode: 'lowest-direct' }))
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
})
|
||||
|
||||
@@ -12,7 +12,7 @@ test('package with default peer dependency, when auto install peers is on', asyn
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/has-default-peer'], await testDefaults({ autoInstallPeers: true }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ test('don\'t install the default peer dependency when it may be resolved from pa
|
||||
await testDefaults({ autoInstallPeers: false })
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/dep-of-pkg-with-1-dep@101.0.0',
|
||||
`/@pnpm.e2e/has-default-peer@1.0.0${createPeersDirSuffix([{ name: '@pnpm.e2e/dep-of-pkg-with-1-dep', version: '101.0.0' }])}`,
|
||||
@@ -34,7 +34,7 @@ test('install the default peer dependency when it cannot be resolved from parent
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/has-default-peer'], await testDefaults({ autoInstallPeers: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0',
|
||||
'/@pnpm.e2e/has-default-peer@1.0.0',
|
||||
@@ -50,7 +50,7 @@ test('package that resolves its own peer dependency', async () => {
|
||||
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@pnpm.e2e+pkg-with-resolved-peer@1.0.0_@pnpm.e2e+peer-c@2.0.0/node_modules/@pnpm.e2e/pkg-with-resolved-peer'))).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/pkg-with-resolved-peer@1.0.0(@pnpm.e2e/peer-c@2.0.0)']?.peerDependencies).toStrictEqual({ '@pnpm.e2e/peer-c': '*' })
|
||||
expect(lockfile.packages['/@pnpm.e2e/pkg-with-resolved-peer@1.0.0(@pnpm.e2e/peer-c@2.0.0)'].dependencies).toHaveProperty(['@pnpm.e2e/peer-c'])
|
||||
|
||||
@@ -232,7 +232,7 @@ test('path to external link is not added to the lockfile, when it resolves a pee
|
||||
await testDefaults({ excludeLinksFromLockfile: true })
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const key = '/@pnpm.e2e/abc@1.0.0(@pnpm.e2e/peer-a@node_modules+@pnpm.e2e+peer-a)(@pnpm.e2e/peer-b@1.0.0)(@pnpm.e2e/peer-c@1.0.0)'
|
||||
expect(lockfile.packages[key]).toBeTruthy()
|
||||
expect(lockfile.packages[key].dependencies?.['@pnpm.e2e/peer-a']).toBe('link:node_modules/@pnpm.e2e/peer-a')
|
||||
|
||||
@@ -23,7 +23,7 @@ test('from a github repo', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['kevva/is-negative'], await testDefaults())
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
'is-negative': 'github:kevva/is-negative',
|
||||
@@ -35,7 +35,7 @@ test('from a github repo through URL', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['https://github.com/kevva/is-negative'], await testDefaults())
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'is-negative': 'github:kevva/is-negative' })
|
||||
})
|
||||
@@ -68,7 +68,7 @@ test('from a github repo with different name via named installation', async () =
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'say-hi': 'github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd' })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'say-hi': {
|
||||
specifier: 'github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
@@ -76,8 +76,8 @@ test('from a github repo with different name via named installation', async () =
|
||||
},
|
||||
})
|
||||
|
||||
await project.isExecutable('.bin/hi')
|
||||
await project.isExecutable('.bin/szia')
|
||||
project.isExecutable('.bin/hi')
|
||||
project.isExecutable('.bin/szia')
|
||||
})
|
||||
|
||||
// This used to fail. Maybe won't be needed once api/install.ts gets refactored and covered with dedicated unit tests
|
||||
@@ -111,7 +111,7 @@ test('from a github repo with different name', async () => {
|
||||
'say-hi': 'github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
})
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'say-hi': {
|
||||
specifier: 'github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
@@ -119,8 +119,8 @@ test('from a github repo with different name', async () => {
|
||||
},
|
||||
})
|
||||
|
||||
await project.isExecutable('.bin/hi')
|
||||
await project.isExecutable('.bin/szia')
|
||||
project.isExecutable('.bin/hi')
|
||||
project.isExecutable('.bin/szia')
|
||||
})
|
||||
|
||||
test('a subdependency is from a github repo with different name', async () => {
|
||||
@@ -132,14 +132,14 @@ test('a subdependency is from a github repo with different name', async () => {
|
||||
|
||||
expect(m).toEqual('Hi')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/has-aliased-git-dependency@1.0.0'].dependencies).toStrictEqual({
|
||||
'@pnpm.e2e/has-say-hi-peer': '1.0.0(github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd)',
|
||||
'say-hi': 'github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
})
|
||||
|
||||
await project.isExecutable('@pnpm.e2e/has-aliased-git-dependency/node_modules/.bin/hi')
|
||||
await project.isExecutable('@pnpm.e2e/has-aliased-git-dependency/node_modules/.bin/szia')
|
||||
project.isExecutable('@pnpm.e2e/has-aliased-git-dependency/node_modules/.bin/hi')
|
||||
project.isExecutable('@pnpm.e2e/has-aliased-git-dependency/node_modules/.bin/szia')
|
||||
|
||||
expect(await exists(path.resolve(`node_modules/.pnpm/${depPathToFilename('@pnpm.e2e/has-say-hi-peer@1.0.0(github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd)')}/node_modules/@pnpm.e2e/has-say-hi-peer`))).toBeTruthy()
|
||||
})
|
||||
@@ -152,7 +152,7 @@ test('from a git repo', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['git+ssh://git@github.com/kevva/is-negative.git'], await testDefaults())
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
// This test is unstable due to dependency on third party registry
|
||||
@@ -165,7 +165,7 @@ test.skip('from a non-github git repo', async () => {
|
||||
|
||||
expect(m).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
const pkgId = 'ikt.pm2.io/ikt/3325a3e39a502418dc2e2e4bf21529cbbde96228'
|
||||
expect(lockfile.packages).toHaveProperty([pkgId])
|
||||
@@ -181,7 +181,7 @@ test('from a github repo the has no package.json file', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['pnpm/for-testing.no-package-json'], await testDefaults())
|
||||
|
||||
await project.has('for-testing.no-package-json')
|
||||
project.has('for-testing.no-package-json')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
'for-testing.no-package-json': 'github:pnpm/for-testing.no-package-json',
|
||||
@@ -193,7 +193,7 @@ test('from a github repo the has no package.json file', async () => {
|
||||
// if there is an unresolved promise, this test will hang until timeout.
|
||||
// e.g. thrown: "Exceeded timeout of 240000 ms for a test.
|
||||
await addDependenciesToPackage({}, ['pnpm/for-testing.no-package-json'], await testDefaults())
|
||||
await project.has('for-testing.no-package-json')
|
||||
project.has('for-testing.no-package-json')
|
||||
})
|
||||
|
||||
test.skip('from a github repo that needs to be built. isolated node linker is used', async () => {
|
||||
@@ -201,19 +201,19 @@ test.skip('from a github repo that needs to be built. isolated node linker is us
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['pnpm-e2e/prepare-script-works'], await testDefaults({ ignoreScripts: true }, { ignoreScripts: true }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ preferFrozenLockfile: false }))
|
||||
await project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true }))
|
||||
await project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true, ignoreScripts: true }, { ignoreScripts: true }))
|
||||
await project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
})
|
||||
|
||||
test.skip('from a github repo that needs to be built. hoisted node linker is used', async () => {
|
||||
@@ -225,30 +225,30 @@ test.skip('from a github repo that needs to be built. hoisted node linker is us
|
||||
await testDefaults({ ignoreScripts: true, nodeLinker: 'hoisted' }, { ignoreScripts: true })
|
||||
)
|
||||
|
||||
await project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ preferFrozenLockfile: false, nodeLinker: 'hoisted' }))
|
||||
await project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true, nodeLinker: 'hoisted' }))
|
||||
await project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.has('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true, ignoreScripts: true, nodeLinker: 'hoisted' }, { ignoreScripts: true }))
|
||||
await project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
project.hasNot('@pnpm.e2e/prepare-script-works/prepare.txt')
|
||||
})
|
||||
|
||||
test('re-adding a git repo with a different tag', async () => {
|
||||
const project = prepareEmpty()
|
||||
let manifest = await addDependenciesToPackage({}, ['kevva/is-negative#1.0.0'], await testDefaults())
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
'is-negative': 'github:kevva/is-negative#1.0.0',
|
||||
})
|
||||
expect(JSON.parse(fs.readFileSync('./node_modules/is-negative/package.json', 'utf8')).version).toBe('1.0.0')
|
||||
let lockfile = await project.readLockfile()
|
||||
let lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['is-negative']).toEqual({
|
||||
specifier: 'github:kevva/is-negative#1.0.0',
|
||||
version: 'github.com/kevva/is-negative/163360a8d3ae6bee9524541043197ff356f8ed99',
|
||||
@@ -265,9 +265,9 @@ test('re-adding a git repo with a different tag', async () => {
|
||||
}
|
||||
)
|
||||
manifest = await addDependenciesToPackage(manifest, ['kevva/is-negative#1.0.1'], await testDefaults())
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
expect(JSON.parse(fs.readFileSync('./node_modules/is-negative/package.json', 'utf8')).version).toBe('1.0.1')
|
||||
lockfile = await project.readLockfile()
|
||||
lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['is-negative']).toEqual({
|
||||
specifier: 'github:kevva/is-negative#1.0.1',
|
||||
version: 'github.com/kevva/is-negative/9a89df745b2ec20ae7445d3d9853ceaeef5b0b72',
|
||||
@@ -302,9 +302,9 @@ test('should not update when adding unrelated dependency', async () => {
|
||||
expect(manifest.dependencies['is-negative']).toBe('github:kevva/is-negative#master')
|
||||
|
||||
const project = assertProject(withGitProtocolDepFixture)
|
||||
await project.has('is-number')
|
||||
project.has('is-number')
|
||||
expect(fs.existsSync('./node_modules/.pnpm/github.com+kevva+is-negative+219c424611ff4a2af15f7deeff4f93c62558c43d')).toBe(true)
|
||||
expect((await project.readLockfile()).dependencies).toEqual({
|
||||
expect((project.readLockfile()).dependencies).toEqual({
|
||||
'is-negative': {
|
||||
specifier: 'github:kevva/is-negative#master',
|
||||
version: 'github.com/kevva/is-negative/219c424611ff4a2af15f7deeff4f93c62558c43d',
|
||||
@@ -336,8 +336,8 @@ test('from subdirectories of a git repo', async () => {
|
||||
'github:RexSkz/test-git-subfolder-fetch#path:/packages/simple-express-server',
|
||||
], await testDefaults())
|
||||
|
||||
await project.has('@my-namespace/simple-react-app')
|
||||
await project.has('@my-namespace/simple-express-server')
|
||||
project.has('@my-namespace/simple-react-app')
|
||||
project.has('@my-namespace/simple-express-server')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
'@my-namespace/simple-express-server': 'github:RexSkz/test-git-subfolder-fetch#path:/packages/simple-express-server',
|
||||
|
||||
@@ -8,8 +8,8 @@ test('tarball from npm registry', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, [`http://localhost:${REGISTRY_MOCK_PORT}/is-array/-/is-array-1.0.1.tgz`], await testDefaults())
|
||||
|
||||
await project.has('is-array')
|
||||
await project.storeHas(`localhost+${REGISTRY_MOCK_PORT}/is-array/1.0.1`)
|
||||
project.has('is-array')
|
||||
project.storeHas(`localhost+${REGISTRY_MOCK_PORT}/is-array/1.0.1`)
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'is-array': `http://localhost:${REGISTRY_MOCK_PORT}/is-array/-/is-array-1.0.1.tgz` })
|
||||
})
|
||||
@@ -19,8 +19,8 @@ test('tarball not from npm registry', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['https://github.com/hegemonic/taffydb/tarball/master'], await testDefaults())
|
||||
|
||||
await project.has('taffydb')
|
||||
await project.storeHas('github.com/hegemonic/taffydb/tarball/master')
|
||||
project.has('taffydb')
|
||||
project.storeHas('github.com/hegemonic/taffydb/tarball/master')
|
||||
})
|
||||
|
||||
test('tarballs from GitHub (is-negative)', async () => {
|
||||
@@ -28,5 +28,5 @@ test('tarballs from GitHub (is-negative)', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['is-negative@https://github.com/kevva/is-negative/archive/1d7e288222b53a0cab90a331f1865220ec29560c.tar.gz'], await testDefaults())
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
@@ -108,11 +108,11 @@ test(`frozen-lockfile: should successfully install when ${WANTED_LOCKFILE} is av
|
||||
},
|
||||
}, await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true }))
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test(`frozen-lockfile: should fail if no ${WANTED_LOCKFILE} is present`, async () => {
|
||||
@@ -136,7 +136,7 @@ test(`prefer-frozen-lockfile: should prefer headless installation when ${WANTED_
|
||||
},
|
||||
}, await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await install(manifest, await testDefaults({ reporter, preferFrozenLockfile: true }))
|
||||
@@ -147,7 +147,7 @@ test(`prefer-frozen-lockfile: should prefer headless installation when ${WANTED_
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test(`prefer-frozen-lockfile: should not prefer headless installation when ${WANTED_LOCKFILE} does not satisfy package.json`, async () => {
|
||||
@@ -159,7 +159,7 @@ test(`prefer-frozen-lockfile: should not prefer headless installation when ${WAN
|
||||
},
|
||||
}, await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await install({
|
||||
@@ -174,7 +174,7 @@ test(`prefer-frozen-lockfile: should not prefer headless installation when ${WAN
|
||||
name: 'pnpm',
|
||||
})).toBeFalsy()
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test(`prefer-frozen-lockfile: should not fail if no ${WANTED_LOCKFILE} is present and project has no deps`, async () => {
|
||||
@@ -198,7 +198,7 @@ test(`prefer-frozen-lockfile+hoistPattern: should prefer headless installation w
|
||||
},
|
||||
}, await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await install(manifest, await testDefaults({
|
||||
@@ -213,8 +213,8 @@ test(`prefer-frozen-lockfile+hoistPattern: should prefer headless installation w
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await project.has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('prefer-frozen-lockfile: should prefer frozen-lockfile when package has linked dependency', async () => {
|
||||
@@ -284,8 +284,8 @@ test('prefer-frozen-lockfile: should prefer frozen-lockfile when package has lin
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await projects['p1'].has('p2')
|
||||
await projects['p2'].has('is-negative')
|
||||
projects['p1'].has('p2')
|
||||
projects['p2'].has('is-negative')
|
||||
})
|
||||
|
||||
test('frozen-lockfile: installation fails if the value of auto-install-peers changes', async () => {
|
||||
|
||||
@@ -226,6 +226,6 @@ test('install with --merge-git-branch-lockfiles when merged lockfile is up to da
|
||||
expect(fs.existsSync(otherLockfilePath)).toBe(false)
|
||||
expect(fs.existsSync(WANTED_LOCKFILE)).toBe(true)
|
||||
|
||||
const wantedLockfileAfterMergeOther = await project.readLockfile()
|
||||
const wantedLockfileAfterMergeOther = project.readLockfile()
|
||||
expect(wantedLockfileAfterMergeOther).toEqual(otherLockfileContent)
|
||||
})
|
||||
|
||||
@@ -22,28 +22,28 @@ test('should hoist dependencies', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['express', '@foo/has-dep-from-same-scope'], await testDefaults({ fastUnpack: false, hoistPattern: '*' }))
|
||||
|
||||
await project.has('express')
|
||||
await project.has('.pnpm/node_modules/debug')
|
||||
await project.has('.pnpm/node_modules/cookie')
|
||||
await project.has('.pnpm/node_modules/mime')
|
||||
await project.has('@foo/has-dep-from-same-scope')
|
||||
await project.has('.pnpm/node_modules/@foo/no-deps')
|
||||
project.has('express')
|
||||
project.has('.pnpm/node_modules/debug')
|
||||
project.has('.pnpm/node_modules/cookie')
|
||||
project.has('.pnpm/node_modules/mime')
|
||||
project.has('@foo/has-dep-from-same-scope')
|
||||
project.has('.pnpm/node_modules/@foo/no-deps')
|
||||
|
||||
// should also hoist bins
|
||||
await project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(Object.keys(modules!.hoistedDependencies).length > 0).toBeTruthy()
|
||||
|
||||
// On repeat install the hoisted packages are preserved (non-headless install)
|
||||
await install(manifest, await testDefaults({ fastUnpack: false, hoistPattern: '*', preferFrozenLockfile: false, modulesCacheMaxAge: 0 }))
|
||||
await project.has('.pnpm/node_modules/debug')
|
||||
expect((await project.readModulesManifest())!.hoistedDependencies).toStrictEqual(modules!.hoistedDependencies)
|
||||
project.has('.pnpm/node_modules/debug')
|
||||
expect((project.readModulesManifest())!.hoistedDependencies).toStrictEqual(modules!.hoistedDependencies)
|
||||
|
||||
// On repeat install the hoisted packages are preserved (headless install)
|
||||
await install(manifest, await testDefaults({ fastUnpack: false, hoistPattern: '*', frozenLockfile: true, modulesCacheMaxAge: 0 }))
|
||||
await project.has('.pnpm/node_modules/debug')
|
||||
expect((await project.readModulesManifest())!.hoistedDependencies).toStrictEqual(modules!.hoistedDependencies)
|
||||
project.has('.pnpm/node_modules/debug')
|
||||
expect((project.readModulesManifest())!.hoistedDependencies).toStrictEqual(modules!.hoistedDependencies)
|
||||
})
|
||||
|
||||
test('should hoist dependencies to the root of node_modules when publicHoistPattern is used', async () => {
|
||||
@@ -53,15 +53,15 @@ test('should hoist dependencies to the root of node_modules when publicHoistPatt
|
||||
['express', '@foo/has-dep-from-same-scope'],
|
||||
await testDefaults({ fastUnpack: false, publicHoistPattern: '*' }))
|
||||
|
||||
await project.has('express')
|
||||
await project.has('debug')
|
||||
await project.has('cookie')
|
||||
await project.has('mime')
|
||||
await project.has('@foo/has-dep-from-same-scope')
|
||||
await project.has('@foo/no-deps')
|
||||
project.has('express')
|
||||
project.has('debug')
|
||||
project.has('cookie')
|
||||
project.has('mime')
|
||||
project.has('@foo/has-dep-from-same-scope')
|
||||
project.has('@foo/no-deps')
|
||||
|
||||
// should also hoist bins
|
||||
await project.isExecutable('.bin/mime')
|
||||
project.isExecutable('.bin/mime')
|
||||
})
|
||||
|
||||
test('public hoist should not override directories that are already in the root of node_modules', async () => {
|
||||
@@ -76,10 +76,10 @@ test('public hoist should not override directories that are already in the root
|
||||
['express@4.18.2'],
|
||||
await testDefaults({ fastUnpack: false, publicHoistPattern: '*' }))
|
||||
|
||||
await project.has('express')
|
||||
await project.has('debug/pnpm-test.txt')
|
||||
await project.has('cookie/pnpm-test.txt')
|
||||
await project.has('mime')
|
||||
project.has('express')
|
||||
project.has('debug/pnpm-test.txt')
|
||||
project.has('cookie/pnpm-test.txt')
|
||||
project.has('mime')
|
||||
})
|
||||
|
||||
test('should hoist some dependencies to the root of node_modules when publicHoistPattern is used and others to the virtual store directory', async () => {
|
||||
@@ -89,15 +89,15 @@ test('should hoist some dependencies to the root of node_modules when publicHois
|
||||
['express', '@foo/has-dep-from-same-scope'],
|
||||
await testDefaults({ fastUnpack: false, hoistPattern: '*', publicHoistPattern: '@foo/*' }))
|
||||
|
||||
await project.has('express')
|
||||
await project.has('.pnpm/node_modules/debug')
|
||||
await project.has('.pnpm/node_modules/cookie')
|
||||
await project.has('.pnpm/node_modules/mime')
|
||||
await project.has('@foo/has-dep-from-same-scope')
|
||||
await project.has('@foo/no-deps')
|
||||
project.has('express')
|
||||
project.has('.pnpm/node_modules/debug')
|
||||
project.has('.pnpm/node_modules/cookie')
|
||||
project.has('.pnpm/node_modules/mime')
|
||||
project.has('@foo/has-dep-from-same-scope')
|
||||
project.has('@foo/no-deps')
|
||||
|
||||
// should also hoist bins
|
||||
await project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
})
|
||||
|
||||
test('should hoist dependencies by pattern', async () => {
|
||||
@@ -105,13 +105,13 @@ test('should hoist dependencies by pattern', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['express'], await testDefaults({ fastUnpack: false, hoistPattern: 'mime' }))
|
||||
|
||||
await project.has('express')
|
||||
await project.hasNot('.pnpm/node_modules/debug')
|
||||
await project.hasNot('.pnpm/node_modules/cookie')
|
||||
await project.has('.pnpm/node_modules/mime')
|
||||
project.has('express')
|
||||
project.hasNot('.pnpm/node_modules/debug')
|
||||
project.hasNot('.pnpm/node_modules/cookie')
|
||||
project.has('.pnpm/node_modules/mime')
|
||||
|
||||
// should also hoist bins
|
||||
await project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
project.isExecutable('.pnpm/node_modules/.bin/mime')
|
||||
})
|
||||
|
||||
test('should remove hoisted dependencies', async () => {
|
||||
@@ -125,9 +125,9 @@ test('should remove hoisted dependencies', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await project.hasNot('express')
|
||||
await project.hasNot('.pnpm/node_modules/debug')
|
||||
await project.hasNot('.pnpm/node_modules/cookie')
|
||||
project.hasNot('express')
|
||||
project.hasNot('.pnpm/node_modules/debug')
|
||||
project.hasNot('.pnpm/node_modules/cookie')
|
||||
})
|
||||
|
||||
test('should not override root packages with hoisted dependencies', async () => {
|
||||
@@ -157,7 +157,7 @@ test('should rehoist when uninstalling a package', async () => {
|
||||
expect(project.requireModule('.pnpm/node_modules/debug/package.json').version).toEqual('2.6.9')
|
||||
expect(project.requireModule('express/package.json').version).toEqual('4.16.0')
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.hoistedDependencies['/debug@2.6.9']).toStrictEqual({ debug: 'private' })
|
||||
})
|
||||
@@ -175,7 +175,7 @@ test('should rehoist after running a general install', async () => {
|
||||
expect(project.requireModule('debug/package.json').version).toEqual('3.1.0')
|
||||
expect(project.requireModule('express/package.json').version).toEqual('4.16.0')
|
||||
|
||||
await project.hasNot('.pnpm/node_modules/debug') // debug not hoisted because it is a direct dep
|
||||
project.hasNot('.pnpm/node_modules/debug') // debug not hoisted because it is a direct dep
|
||||
|
||||
// read this module path because we can't use requireModule again, as it is cached
|
||||
const prevExpressModulePath = await resolveLinkTarget('./node_modules/express')
|
||||
@@ -191,7 +191,7 @@ test('should rehoist after running a general install', async () => {
|
||||
const currExpressModulePath = await resolveLinkTarget('./node_modules/express')
|
||||
expect(prevExpressModulePath).toEqual(currExpressModulePath)
|
||||
|
||||
await project.has('.pnpm/node_modules/debug') // debug hoisted because it is not a direct dep anymore
|
||||
project.has('.pnpm/node_modules/debug') // debug hoisted because it is not a direct dep anymore
|
||||
})
|
||||
|
||||
test('should not override aliased dependencies', async () => {
|
||||
@@ -242,11 +242,11 @@ test('hoist by alias', async () => {
|
||||
// pkg-with-1-aliased-dep aliases @pnpm.e2e/dep-of-pkg-with-1-dep as just "dep"
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-aliased-dep'], await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await project.has('@pnpm.e2e/pkg-with-1-aliased-dep')
|
||||
await project.has('.pnpm/node_modules/dep')
|
||||
await project.hasNot('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.has('@pnpm.e2e/pkg-with-1-aliased-dep')
|
||||
project.has('.pnpm/node_modules/dep')
|
||||
project.hasNot('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.hoistedDependencies).toStrictEqual({ '/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0': { dep: 'private' } })
|
||||
})
|
||||
@@ -262,14 +262,14 @@ test('should remove aliased hoisted dependencies', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-aliased-dep')
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-aliased-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
try {
|
||||
await resolveLinkTarget('./node_modules/dep')
|
||||
throw new Error('should have failed')
|
||||
} catch (e) {}
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.hoistedDependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -285,7 +285,7 @@ test('should update .modules.yaml when pruning if we are flattening', async () =
|
||||
|
||||
await install({}, await testDefaults({ hoistPattern: '*', pruneStore: true }))
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.hoistedDependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -303,7 +303,7 @@ test('should rehoist after pruning', async () => {
|
||||
expect(project.requireModule('debug/package.json').version).toEqual('3.1.0')
|
||||
expect(project.requireModule('express/package.json').version).toEqual('4.16.0')
|
||||
|
||||
await project.hasNot('.pnpm/node_modules/debug') // debug is not hoisted because it is a direct dep
|
||||
project.hasNot('.pnpm/node_modules/debug') // debug is not hoisted because it is a direct dep
|
||||
// read this module path because we can't use requireModule again, as it is cached
|
||||
const prevExpressModulePath = await resolveLinkTarget('./node_modules/express')
|
||||
|
||||
@@ -319,14 +319,14 @@ test('should rehoist after pruning', async () => {
|
||||
const currExpressModulePath = await resolveLinkTarget('./node_modules/express')
|
||||
expect(prevExpressModulePath).toEqual(currExpressModulePath)
|
||||
|
||||
await project.has('.pnpm/node_modules/debug') // debug is hoisted because it is not a direct dep anymore
|
||||
project.has('.pnpm/node_modules/debug') // debug is hoisted because it is not a direct dep anymore
|
||||
})
|
||||
|
||||
test('should hoist correctly peer dependencies', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/using-ajv'], await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await project.has('.pnpm/node_modules/ajv-keywords')
|
||||
project.has('.pnpm/node_modules/ajv-keywords')
|
||||
})
|
||||
|
||||
test('should uninstall correctly peer dependencies', async () => {
|
||||
@@ -393,36 +393,36 @@ test('hoist-pattern: hoist all dependencies to the virtual store node_modules',
|
||||
]
|
||||
await mutateModules(mutatedProjects, await testDefaults({ allProjects, hoistPattern: '*' }))
|
||||
|
||||
await projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
|
||||
await projects['package'].has('@pnpm.e2e/foobar')
|
||||
await projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
projects['package'].has('@pnpm.e2e/foobar')
|
||||
projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await rimraf('package/node_modules')
|
||||
|
||||
await mutateModules(mutatedProjects, await testDefaults({ allProjects, frozenLockfile: true, hoistPattern: '*' }))
|
||||
|
||||
await projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
|
||||
await projects['package'].has('@pnpm.e2e/foobar')
|
||||
await projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
projects['package'].has('@pnpm.e2e/foobar')
|
||||
projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
})
|
||||
|
||||
test('hoist when updating in one of the workspace projects', async () => {
|
||||
@@ -479,7 +479,7 @@ test('hoist when updating in one of the workspace projects', async () => {
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
{
|
||||
const modulesManifest = await rootModules.readModulesManifest()
|
||||
const modulesManifest = rootModules.readModulesManifest()
|
||||
expect(modulesManifest?.hoistedDependencies).toStrictEqual({
|
||||
'/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' },
|
||||
'/@pnpm.e2e/foo@100.0.0': { '@pnpm.e2e/foo': 'private' },
|
||||
@@ -494,7 +494,7 @@ test('hoist when updating in one of the workspace projects', async () => {
|
||||
},
|
||||
], await testDefaults({ allProjects, hoistPattern: '*', pruneLockfileImporters: false }))
|
||||
|
||||
const lockfile = await rootModules.readCurrentLockfile()
|
||||
const lockfile = rootModules.readCurrentLockfile()
|
||||
|
||||
expect(
|
||||
Object.keys(lockfile.packages)
|
||||
@@ -508,7 +508,7 @@ test('hoist when updating in one of the workspace projects', async () => {
|
||||
)
|
||||
|
||||
{
|
||||
const modulesManifest = await rootModules.readModulesManifest()
|
||||
const modulesManifest = rootModules.readModulesManifest()
|
||||
expect(modulesManifest?.hoistedDependencies).toStrictEqual({
|
||||
'/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0': { '@pnpm.e2e/dep-of-pkg-with-1-dep': 'private' },
|
||||
})
|
||||
@@ -519,9 +519,9 @@ test('should recreate node_modules with hoisting', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults({ hoistPattern: undefined }))
|
||||
|
||||
await project.hasNot('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
{
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
expect(modulesManifest?.hoistPattern).toBeFalsy()
|
||||
expect(modulesManifest?.hoistedDependencies).toStrictEqual({})
|
||||
}
|
||||
@@ -532,10 +532,10 @@ test('should recreate node_modules with hoisting', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await project.has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
{
|
||||
const modulesManifest = await project.readModulesManifest()
|
||||
const modulesManifest = project.readModulesManifest()
|
||||
expect(modulesManifest?.hoistPattern).toBeTruthy()
|
||||
expect(Object.keys(modulesManifest?.hoistedDependencies ?? {}).length > 0).toBeTruthy()
|
||||
}
|
||||
@@ -556,16 +556,16 @@ test('hoisting should not create a broken symlink to a skipped optional dependen
|
||||
|
||||
await install(manifest, await testDefaults({ publicHoistPattern: '*' }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/dep-of-optional-pkg')
|
||||
expect(await rootModules.readCurrentLockfile()).toStrictEqual(await rootModules.readLockfile())
|
||||
project.hasNot('@pnpm.e2e/dep-of-optional-pkg')
|
||||
expect(rootModules.readCurrentLockfile()).toStrictEqual(rootModules.readLockfile())
|
||||
|
||||
// Verifying the same with headless installation
|
||||
await rimraf('node_modules')
|
||||
|
||||
await install(manifest, await testDefaults({ publicHoistPattern: '*' }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/dep-of-optional-pkg')
|
||||
expect(await rootModules.readCurrentLockfile()).toStrictEqual(await rootModules.readLockfile())
|
||||
project.hasNot('@pnpm.e2e/dep-of-optional-pkg')
|
||||
expect(rootModules.readCurrentLockfile()).toStrictEqual(rootModules.readLockfile())
|
||||
})
|
||||
|
||||
test('the hoisted packages should not override the bin files of the direct dependencies', async () => {
|
||||
@@ -678,7 +678,7 @@ test('hoist packages which is in the dependencies tree of the selected projects'
|
||||
|
||||
await mutateModules(importers, await testDefaults({ allProjects, hoistPattern: '*' }))
|
||||
|
||||
await root.has('.pnpm/node_modules/is-positive')
|
||||
root.has('.pnpm/node_modules/is-positive')
|
||||
const { version } = root.requireModule('.pnpm/node_modules/is-positive/package.json')
|
||||
expect(version).toBe('3.0.0')
|
||||
})
|
||||
@@ -768,15 +768,15 @@ test('only hoist packages which is in the dependencies tree of the selected proj
|
||||
rootDir: path.resolve('project-2'),
|
||||
}, await testDefaults({ hoistPattern: '*' }))
|
||||
|
||||
await root.has('.pnpm/node_modules/@babel/runtime-corejs3')
|
||||
root.has('.pnpm/node_modules/@babel/runtime-corejs3')
|
||||
const { version: runtimeVersion } = root.requireModule('.pnpm/node_modules/@babel/runtime-corejs3/package.json')
|
||||
expect(runtimeVersion).toBe('7.15.4')
|
||||
|
||||
await root.has('.pnpm/node_modules/core-js-pure')
|
||||
root.has('.pnpm/node_modules/core-js-pure')
|
||||
const { version: coreJsVersion } = root.requireModule('.pnpm/node_modules/core-js-pure/package.json')
|
||||
expect(coreJsVersion).toBe('3.17.3')
|
||||
|
||||
await root.has('.pnpm/node_modules/regenerator-runtime')
|
||||
root.has('.pnpm/node_modules/regenerator-runtime')
|
||||
const { version: regeneratorVersion } = root.requireModule('.pnpm/node_modules/regenerator-runtime/package.json')
|
||||
expect(regeneratorVersion).toBe('0.13.9')
|
||||
})
|
||||
@@ -896,21 +896,21 @@ test('hoistWorkspacePackages should hoist all workspace projects', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
await projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
await projects['root'].has('.pnpm/node_modules/package')
|
||||
await projects['root'].has('.pnpm/node_modules/package2')
|
||||
await projects['root'].hasNot('.pnpm/node_modules/root')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
await projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
projects['root'].has('@pnpm.e2e/pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foobar')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/foo')
|
||||
projects['root'].has('.pnpm/node_modules/@pnpm.e2e/bar')
|
||||
projects['root'].has('.pnpm/node_modules/package')
|
||||
projects['root'].has('.pnpm/node_modules/package2')
|
||||
projects['root'].hasNot('.pnpm/node_modules/root')
|
||||
projects['root'].hasNot('@pnpm.e2e/foobar')
|
||||
projects['root'].hasNot('@pnpm.e2e/foo')
|
||||
projects['root'].hasNot('@pnpm.e2e/bar')
|
||||
|
||||
await projects['package'].has('@pnpm.e2e/foobar')
|
||||
await projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
await projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
projects['package'].has('@pnpm.e2e/foobar')
|
||||
projects['package'].hasNot('@pnpm.e2e/foo')
|
||||
projects['package'].hasNot('@pnpm.e2e/bar')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await mutateModules(mutatedProjects, await testDefaults({
|
||||
@@ -920,7 +920,7 @@ test('hoistWorkspacePackages should hoist all workspace projects', async () => {
|
||||
hoistWorkspacePackages: true,
|
||||
workspacePackages,
|
||||
}))
|
||||
await projects['root'].has('.pnpm/node_modules/package')
|
||||
await projects['root'].has('.pnpm/node_modules/package2')
|
||||
await projects['root'].hasNot('.pnpm/node_modules/root')
|
||||
projects['root'].has('.pnpm/node_modules/package')
|
||||
projects['root'].has('.pnpm/node_modules/package2')
|
||||
projects['root'].hasNot('.pnpm/node_modules/root')
|
||||
})
|
||||
|
||||
@@ -38,11 +38,11 @@ test('readPackage, afterAllResolved hooks', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
expect(afterAllResolved).toHaveBeenCalledTimes(1)
|
||||
expect(afterAllResolved.mock.calls[0][0].lockfileVersion).toEqual(LOCKFILE_VERSION)
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile).toHaveProperty(['foo'], 'foo')
|
||||
})
|
||||
|
||||
@@ -76,11 +76,11 @@ test('readPackage, afterAllResolved async hooks', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
expect(afterAllResolved).toHaveBeenCalledTimes(1)
|
||||
expect(afterAllResolved.mock.calls[0][0].lockfileVersion).toEqual(LOCKFILE_VERSION)
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile).toHaveProperty(['foo'], 'foo')
|
||||
})
|
||||
|
||||
@@ -120,5 +120,5 @@ test('readPackage hooks array', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
@@ -124,21 +124,21 @@ test('inject local packages', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -174,7 +174,7 @@ test('inject local packages', async () => {
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -192,15 +192,15 @@ test('inject local packages', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
@@ -208,7 +208,7 @@ test('inject local packages', async () => {
|
||||
allProjects[0].manifest.dependencies!['is-negative'] = '2.0.0'
|
||||
await mutateModules(importers, await testDefaults({ autoInstallPeers: false, allProjects, workspacePackages }))
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -230,7 +230,7 @@ test('inject local packages', async () => {
|
||||
},
|
||||
dev: false,
|
||||
})
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -353,21 +353,21 @@ test('inject local packages declared via file protocol', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -403,7 +403,7 @@ test('inject local packages declared via file protocol', async () => {
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -421,15 +421,15 @@ test('inject local packages declared via file protocol', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
@@ -438,7 +438,7 @@ test('inject local packages declared via file protocol', async () => {
|
||||
writeJsonFile('project-1/package.json', allProjects[0].manifest)
|
||||
await mutateModules(importers, await testDefaults({ autoInstallPeers: false, allProjects, workspacePackages }))
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -460,7 +460,7 @@ test('inject local packages declared via file protocol', async () => {
|
||||
},
|
||||
dev: false,
|
||||
})
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -573,21 +573,21 @@ test('inject local packages when the file protocol is used', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.packages['file:project-1(is-positive@1.0.0)']).toEqual({
|
||||
resolution: {
|
||||
directory: 'project-1',
|
||||
@@ -618,7 +618,7 @@ test('inject local packages when the file protocol is used', async () => {
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -636,15 +636,15 @@ test('inject local packages when the file protocol is used', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(8)
|
||||
|
||||
@@ -657,7 +657,7 @@ test('inject local packages when the file protocol is used', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.packages['file:project-1(is-positive@1.0.0)']).toEqual({
|
||||
resolution: {
|
||||
directory: 'project-1',
|
||||
@@ -674,7 +674,7 @@ test('inject local packages when the file protocol is used', async () => {
|
||||
},
|
||||
dev: false,
|
||||
})
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
@@ -764,17 +764,17 @@ test('inject local packages and relink them after build', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
expect(await pathExists(path.resolve('project-2/node_modules/project-1/main.js'))).toBeTruthy()
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -809,12 +809,12 @@ test('inject local packages and relink them after build', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
expect(await pathExists(path.resolve('project-2/node_modules/project-1/main.js'))).toBeTruthy()
|
||||
})
|
||||
@@ -879,17 +879,17 @@ test('inject local packages and relink them after build (file protocol is used)'
|
||||
]
|
||||
await mutateModules(importers, await testDefaults({ autoInstallPeers: false, allProjects }))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
expect(await pathExists(path.resolve('project-2/node_modules/project-1/main.js'))).toBeTruthy()
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.packages['file:project-1(is-positive@1.0.0)']).toEqual({
|
||||
resolution: {
|
||||
directory: 'project-1',
|
||||
@@ -918,12 +918,12 @@ test('inject local packages and relink them after build (file protocol is used)'
|
||||
frozenLockfile: true,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
expect(await pathExists(path.resolve('project-2/node_modules/project-1/main.js'))).toBeTruthy()
|
||||
})
|
||||
@@ -1045,19 +1045,19 @@ test('inject local packages when node-linker is hoisted', async () => {
|
||||
}))
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
await rootModules.has('is-negative')
|
||||
await rootModules.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await rootModules.has('is-positive')
|
||||
rootModules.has('is-negative')
|
||||
rootModules.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
rootModules.has('is-positive')
|
||||
|
||||
await projects['project-2'].has('project-1')
|
||||
await projects['project-2'].has('project-1/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('project-1/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
await projects['project-3'].has('project-1')
|
||||
await projects['project-3'].has('project-2')
|
||||
await projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-1')
|
||||
projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -1095,7 +1095,7 @@ test('inject local packages when node-linker is hoisted', async () => {
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toEqual(path.join('project-2', 'node_modules', 'project-1'))
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toEqual(path.join('project-3', 'node_modules', 'project-1'))
|
||||
@@ -1228,19 +1228,19 @@ test('inject local packages when node-linker is hoisted and dependenciesMeta is
|
||||
} as any)) // eslint-disable-line
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
await rootModules.has('is-negative')
|
||||
await rootModules.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await rootModules.has('is-positive')
|
||||
rootModules.has('is-negative')
|
||||
rootModules.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
rootModules.has('is-positive')
|
||||
|
||||
await projects['project-2'].has('project-1')
|
||||
await projects['project-2'].has('project-1/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('project-1/node_modules/@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
await projects['project-3'].has('project-1')
|
||||
await projects['project-3'].has('project-2')
|
||||
await projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-1')
|
||||
projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -1278,7 +1278,7 @@ test('inject local packages when node-linker is hoisted and dependenciesMeta is
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toEqual(path.join('project-2', 'node_modules', 'project-1'))
|
||||
expect(modulesState?.injectedDeps?.['project-1'][1]).toEqual(path.join('project-3', 'node_modules', 'project-1'))
|
||||
@@ -1388,7 +1388,7 @@ test('peer dependency of injected project should be resolved correctly', async (
|
||||
}))
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.packages?.['file:project-2(project-1@project-1)'].dependencies?.['project-1']).toEqual('link:project-1')
|
||||
})
|
||||
|
||||
@@ -1598,11 +1598,11 @@ test('injected package is kept up-to-date when it is hoisted to multiple places'
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-positive/prepare.txt')
|
||||
await projects['project-2'].has('is-positive/prepare.txt')
|
||||
projects['project-1'].has('is-positive/prepare.txt')
|
||||
projects['project-2'].has('is-positive/prepare.txt')
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-3'].length).toEqual(2)
|
||||
expect(modulesState?.injectedDeps?.['project-3'][0]).toEqual(path.join('project-1', 'node_modules', 'is-positive'))
|
||||
expect(modulesState?.injectedDeps?.['project-3'][1]).toEqual(path.join('project-2', 'node_modules', 'is-positive'))
|
||||
@@ -1965,21 +1965,21 @@ test('injected local packages are deduped', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(7)
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
@@ -2000,7 +2000,7 @@ test('injected local packages are deduped', async () => {
|
||||
dev: false,
|
||||
})
|
||||
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(1)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
}
|
||||
@@ -2018,15 +2018,15 @@ test('injected local packages are deduped', async () => {
|
||||
workspacePackages,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('is-positive')
|
||||
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].has('project-1')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].has('project-1')
|
||||
|
||||
await projects['project-3'].has('is-positive')
|
||||
await projects['project-3'].has('project-2')
|
||||
projects['project-3'].has('is-positive')
|
||||
projects['project-3'].has('project-2')
|
||||
|
||||
expect(fs.readdirSync('node_modules/.pnpm').length).toBe(7)
|
||||
|
||||
@@ -2034,14 +2034,14 @@ test('injected local packages are deduped', async () => {
|
||||
allProjects[0].manifest.dependencies!['is-negative'] = '2.0.0'
|
||||
await mutateModules(importers, await testDefaults({ autoInstallPeers: true, allProjects, dedupeInjectedDeps: true, workspacePackages }))
|
||||
{
|
||||
const lockfile = await rootModules.readLockfile()
|
||||
const lockfile = rootModules.readLockfile()
|
||||
expect(lockfile.importers['project-2'].dependenciesMeta).toEqual({
|
||||
'project-1': {
|
||||
injected: true,
|
||||
},
|
||||
})
|
||||
expect(lockfile.packages['file:project-1(is-positive@1.0.0)']).toBeFalsy()
|
||||
const modulesState = await rootModules.readModulesManifest()
|
||||
const modulesState = rootModules.readModulesManifest()
|
||||
expect(modulesState?.injectedDeps?.['project-1'].length).toEqual(1)
|
||||
expect(modulesState?.injectedDeps?.['project-1'][0]).toContain(`node_modules${path.sep}.pnpm`)
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ test('fail if installed package does not support the current engine and engine-s
|
||||
engineStrict: true,
|
||||
}))
|
||||
).rejects.toThrow()
|
||||
await project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
await project.storeHasNot('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
project.storeHasNot('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
})
|
||||
|
||||
test('do not fail if installed package does not support the current engine and engine-strict = false', async () => {
|
||||
@@ -22,10 +22,10 @@ test('do not fail if installed package does not support the current engine and e
|
||||
engineStrict: false,
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/not-compatible-with-any-os')
|
||||
await project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
project.has('@pnpm.e2e/not-compatible-with-any-os')
|
||||
project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'].os).toStrictEqual(['this-os-does-not-exist'])
|
||||
})
|
||||
|
||||
@@ -37,10 +37,10 @@ test('do not fail if installed package requires the node version that was passed
|
||||
nodeVersion: '0.10.0',
|
||||
}))
|
||||
|
||||
await project.has('@pnpm.e2e/for-legacy-node')
|
||||
await project.storeHas('@pnpm.e2e/for-legacy-node', '1.0.0')
|
||||
project.has('@pnpm.e2e/for-legacy-node')
|
||||
project.storeHas('@pnpm.e2e/for-legacy-node', '1.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/for-legacy-node@1.0.0'].engines).toStrictEqual({ node: '0.10' })
|
||||
})
|
||||
|
||||
@@ -49,7 +49,7 @@ test(`save cpu field to ${WANTED_LOCKFILE}`, async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/has-cpu-specified'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(
|
||||
lockfile.packages['/@pnpm.e2e/has-cpu-specified@1.0.0'].cpu
|
||||
@@ -63,7 +63,7 @@ test(`engines field is not added to ${WANTED_LOCKFILE} when "node": "*" is in "e
|
||||
|
||||
await addDependenciesToPackage({}, ['jsonify@0.0.0'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/jsonify@0.0.0']).not.toHaveProperty(['engines'])
|
||||
})
|
||||
|
||||
@@ -55,7 +55,7 @@ test('run pre/postinstall scripts', async () => {
|
||||
expect(typeof generatedByPostinstall).toBe('function')
|
||||
}
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild)
|
||||
})
|
||||
|
||||
@@ -293,7 +293,7 @@ test('run prepare script for git-hosted dependencies', async () => {
|
||||
'postinstall',
|
||||
])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['github.com/pnpm/test-git-fetch/d222f6bfbdea55c032fdb5f0538d52b2a484bbbf'].prepare === true).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -302,8 +302,8 @@ test('lifecycle scripts run before linking bins', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/generated-bins'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.isExecutable('.bin/cmd1')
|
||||
await project.isExecutable('.bin/cmd2')
|
||||
project.isExecutable('.bin/cmd1')
|
||||
project.isExecutable('.bin/cmd2')
|
||||
|
||||
await rimraf('node_modules')
|
||||
|
||||
@@ -313,8 +313,8 @@ test('lifecycle scripts run before linking bins', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ frozenLockfile: true }))
|
||||
|
||||
await project.isExecutable('.bin/cmd1')
|
||||
await project.isExecutable('.bin/cmd2')
|
||||
project.isExecutable('.bin/cmd1')
|
||||
project.isExecutable('.bin/cmd2')
|
||||
})
|
||||
|
||||
test('hoisting does not fail on commands that will be created by lifecycle scripts on a later stage', async () => {
|
||||
@@ -322,8 +322,8 @@ test('hoisting does not fail on commands that will be created by lifecycle scrip
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/has-generated-bins-as-dep'], await testDefaults({ fastUnpack: false, hoistPattern: '*' }))
|
||||
|
||||
// await project.isExecutable('.pnpm/node_modules/.bin/cmd1')
|
||||
// await project.isExecutable('.pnpm/node_modules/.bin/cmd2')
|
||||
// project.isExecutable('.pnpm/node_modules/.bin/cmd1')
|
||||
// project.isExecutable('.pnpm/node_modules/.bin/cmd2')
|
||||
|
||||
// Testing the same with headless installation
|
||||
await rimraf('node_modules')
|
||||
@@ -334,8 +334,8 @@ test('hoisting does not fail on commands that will be created by lifecycle scrip
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ frozenLockfile: true, hoistPattern: '*' }))
|
||||
|
||||
// await project.isExecutable('.pnpm/node_modules/.bin/cmd1')
|
||||
// await project.isExecutable('.pnpm/node_modules/.bin/cmd2')
|
||||
// project.isExecutable('.pnpm/node_modules/.bin/cmd1')
|
||||
// project.isExecutable('.pnpm/node_modules/.bin/cmd2')
|
||||
})
|
||||
|
||||
test('bins are linked even if lifecycle scripts are ignored', async () => {
|
||||
@@ -351,8 +351,8 @@ test('bins are linked even if lifecycle scripts are ignored', async () => {
|
||||
await testDefaults({ fastUnpack: false, ignoreScripts: true })
|
||||
)
|
||||
|
||||
await project.isExecutable('.bin/peer-with-bin')
|
||||
await project.isExecutable('@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/peer-with-bin')
|
||||
project.isExecutable('@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin/hello-world-js-bin')
|
||||
|
||||
// Verifying that the scripts were ignored
|
||||
expect(await exists('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/package.json')).toBeTruthy()
|
||||
@@ -366,8 +366,8 @@ test('bins are linked even if lifecycle scripts are ignored', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ frozenLockfile: true, ignoreScripts: true }))
|
||||
|
||||
await project.isExecutable('.bin/peer-with-bin')
|
||||
await project.isExecutable('@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/peer-with-bin')
|
||||
project.isExecutable('@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin/hello-world-js-bin')
|
||||
|
||||
// Verifying that the scripts were ignored
|
||||
expect(await exists('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/package.json')).toBeTruthy()
|
||||
@@ -396,7 +396,7 @@ test('dependency should not be added to current lockfile if it was not built suc
|
||||
}, await testDefaults({ frozenLockfile: true }))
|
||||
).rejects.toThrow()
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeFalsy()
|
||||
expect(project.readCurrentLockfile()).toBeFalsy()
|
||||
})
|
||||
|
||||
test('scripts have access to unlisted bins when hoisting is used', async () => {
|
||||
@@ -423,7 +423,7 @@ test('selectively ignore scripts in some dependencies by neverBuiltDependencies'
|
||||
expect(await exists('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')).toBeFalsy()
|
||||
expect(await exists('node_modules/@pnpm.e2e/install-script-example/generated-by-install.js')).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.neverBuiltDependencies).toStrictEqual(neverBuiltDependencies)
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
@@ -461,7 +461,7 @@ test('selectively allow scripts in some dependencies by onlyBuiltDependencies',
|
||||
expect(await exists('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')).toBeFalsy()
|
||||
expect(await exists('node_modules/@pnpm.e2e/install-script-example/generated-by-install.js')).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.onlyBuiltDependencies).toStrictEqual(onlyBuiltDependencies)
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBe(true)
|
||||
@@ -526,7 +526,7 @@ test('lockfile is updated if neverBuiltDependencies is changed', async () => {
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.neverBuiltDependencies).toBeFalsy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
@@ -540,7 +540,7 @@ test('lockfile is updated if neverBuiltDependencies is changed', async () => {
|
||||
}, await testDefaults({ neverBuiltDependencies }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.neverBuiltDependencies).toStrictEqual(neverBuiltDependencies)
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
@@ -555,7 +555,7 @@ test('lockfile is updated if onlyBuiltDependencies is changed', async () => {
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.onlyBuiltDependencies).toBeFalsy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBeTruthy()
|
||||
@@ -569,7 +569,7 @@ test('lockfile is updated if onlyBuiltDependencies is changed', async () => {
|
||||
}, await testDefaults({ onlyBuiltDependencies }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.onlyBuiltDependencies).toStrictEqual(onlyBuiltDependencies)
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
@@ -583,7 +583,7 @@ test('lockfile is updated if onlyBuiltDependencies is changed', async () => {
|
||||
}, await testDefaults({ onlyBuiltDependencies }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.onlyBuiltDependencies).toStrictEqual(onlyBuiltDependencies)
|
||||
expect(lockfile.packages['/@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'].requiresBuild).toBe(true)
|
||||
expect(lockfile.packages['/@pnpm.e2e/install-script-example@1.0.0'].requiresBuild).toBe(undefined)
|
||||
@@ -597,7 +597,7 @@ test('lifecycle scripts have access to package\'s own binary by binary name', as
|
||||
await testDefaults({ fastUnpack: false })
|
||||
)
|
||||
|
||||
await project.isExecutable('.pnpm/@pnpm.e2e+runs-own-bin@1.0.0/node_modules/@pnpm.e2e/runs-own-bin/node_modules/.bin/runs-own-bin')
|
||||
project.isExecutable('.pnpm/@pnpm.e2e+runs-own-bin@1.0.0/node_modules/@pnpm.e2e/runs-own-bin/node_modules/.bin/runs-own-bin')
|
||||
})
|
||||
|
||||
test('lifecycle scripts run after linking root dependencies', async () => {
|
||||
@@ -754,16 +754,16 @@ test('run pre/postinstall scripts in a workspace that uses node-linker=hoisted',
|
||||
nodeLinker: 'hoisted',
|
||||
}))
|
||||
const rootProject = assertProject(process.cwd())
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
})
|
||||
|
||||
test('run pre/postinstall scripts in a project that uses node-linker=hoisted. Should not fail on repeat install', async () => {
|
||||
|
||||
@@ -42,7 +42,7 @@ test('local file', async () => {
|
||||
|
||||
expect(m).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -79,12 +79,12 @@ test('local directory with no package.json', async () => {
|
||||
|
||||
const expectedSpecs = { pkg: 'file:pkg' }
|
||||
expect(manifest.dependencies).toStrictEqual(expectedSpecs)
|
||||
await project.has('pkg')
|
||||
project.has('pkg')
|
||||
|
||||
await rimraf('node_modules')
|
||||
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true }))
|
||||
await project.has('pkg')
|
||||
project.has('pkg')
|
||||
})
|
||||
|
||||
test('local file via link:', async () => {
|
||||
@@ -100,7 +100,7 @@ test('local file via link:', async () => {
|
||||
|
||||
expect(m).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -132,7 +132,7 @@ test('local file with symlinked node_modules', async () => {
|
||||
|
||||
expect(m).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -169,7 +169,7 @@ test('tarball local package', async () => {
|
||||
const pkgSpec = `file:${normalizePath(f.find('tar-pkg/tar-pkg-1.0.0.tgz'))}`
|
||||
expect(manifest.dependencies).toStrictEqual({ 'tar-pkg': pkgSpec })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages[lockfile.dependencies['tar-pkg'].version]).toStrictEqual({
|
||||
dev: false,
|
||||
name: 'tar-pkg',
|
||||
@@ -199,7 +199,7 @@ test('tarball local package from project directory', async () => {
|
||||
const pkgSpec = 'file:tar-pkg-1.0.0.tgz'
|
||||
expect(manifest.dependencies).toStrictEqual({ 'tar-pkg': pkgSpec })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['tar-pkg'].version).toBe(pkgSpec)
|
||||
expect(lockfile.packages[lockfile.dependencies['tar-pkg'].version]).toStrictEqual({
|
||||
dev: false,
|
||||
@@ -218,13 +218,13 @@ test('update tarball local package when its integrity changes', async () => {
|
||||
f.copy('tar-pkg-with-dep-1/tar-pkg-with-dep-1.0.0.tgz', path.resolve('..', 'tar.tgz'))
|
||||
const manifest = await addDependenciesToPackage({}, ['../tar.tgz'], await testDefaults())
|
||||
|
||||
const lockfile1 = await project.readLockfile()
|
||||
const lockfile1 = project.readLockfile()
|
||||
expect(lockfile1.packages['file:../tar.tgz'].dependencies!['is-positive']).toBe('1.0.0')
|
||||
|
||||
f.copy('tar-pkg-with-dep-2/tar-pkg-with-dep-1.0.0.tgz', path.resolve('..', 'tar.tgz'))
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
const lockfile2 = await project.readLockfile()
|
||||
const lockfile2 = project.readLockfile()
|
||||
expect(lockfile2.packages['file:../tar.tgz'].dependencies!['is-positive']).toBe('2.0.0')
|
||||
|
||||
const manifestOfTarballDep = await import(path.resolve('node_modules/tar-pkg-with-dep/package.json'))
|
||||
@@ -239,7 +239,7 @@ test('do not update deps when installing in a project that has local tarball dep
|
||||
f.copy('tar-pkg-with-dep-1/tar-pkg-with-dep-1.0.0.tgz', path.resolve('..', 'tar.tgz'))
|
||||
const manifest = await addDependenciesToPackage({}, ['../tar.tgz', '@pnpm.e2e/peer-a'], await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
const initialLockfile = await project.readLockfile()
|
||||
const initialLockfile = project.readLockfile()
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/peer-a', version: '1.0.1', distTag: 'latest' })
|
||||
|
||||
@@ -249,7 +249,7 @@ test('do not update deps when installing in a project that has local tarball dep
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults())
|
||||
|
||||
const latestLockfile = await project.readLockfile()
|
||||
const latestLockfile = project.readLockfile()
|
||||
|
||||
expect(initialLockfile).toStrictEqual(latestLockfile)
|
||||
})
|
||||
@@ -397,7 +397,7 @@ test('re-install should update local file dependency', async () => {
|
||||
expect(m).toBeTruthy()
|
||||
await expect(fs.access('./node_modules/local-pkg/add.js')).rejects.toThrow()
|
||||
|
||||
let lockfile = await project.readLockfile()
|
||||
let lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -441,7 +441,7 @@ test('re-install should update local file dependency', async () => {
|
||||
}), 'utf8')
|
||||
await install(manifest, await testDefaults())
|
||||
await expect(fs.access('./node_modules/.pnpm/is-positive@1.0.0')).resolves.toBeUndefined()
|
||||
lockfile = await project.readLockfile()
|
||||
lockfile = project.readLockfile()
|
||||
expect(lockfile).toMatchObject({
|
||||
packages: {
|
||||
'file:../local-pkg': {
|
||||
@@ -465,7 +465,7 @@ test('re-install should update local file dependency', async () => {
|
||||
}), 'utf8')
|
||||
await install(manifest, await testDefaults())
|
||||
await expect(fs.access('./node_modules/.pnpm/is-positive@2.0.0')).resolves.toBeUndefined()
|
||||
lockfile = await project.readLockfile()
|
||||
lockfile = project.readLockfile()
|
||||
expect(lockfile).toMatchObject({
|
||||
packages: {
|
||||
'file:../local-pkg': {
|
||||
|
||||
@@ -65,5 +65,5 @@ test(`tarball location is correctly saved to ${WANTED_LOCKFILE} when a shared ${
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ frozenLockfile: true, lockfileDir }))
|
||||
|
||||
await project.has('tar-pkg-with-dep')
|
||||
project.has('tar-pkg-with-dep')
|
||||
})
|
||||
|
||||
@@ -19,31 +19,31 @@ test('install with lockfileOnly = true', async () => {
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep@100.0.0'], opts)
|
||||
const { cafsHas } = assertStore(opts.storeDir)
|
||||
|
||||
await cafsHas('@pnpm.e2e/pkg-with-1-dep', '100.0.0')
|
||||
cafsHas('@pnpm.e2e/pkg-with-1-dep', '100.0.0')
|
||||
expect(await exists(path.join(opts.cacheDir, `metadata/localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep.json`))).toBeTruthy()
|
||||
await cafsHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
cafsHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
expect(await exists(path.join(opts.cacheDir, `metadata/localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/dep-of-pkg-with-1-dep.json`))).toBeTruthy()
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
|
||||
expect(manifest.dependencies!['@pnpm.e2e/pkg-with-1-dep']).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/pkg-with-1-dep']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0']).toBeTruthy()
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile).toBeFalsy()
|
||||
|
||||
console.log(`doing repeat install when ${WANTED_LOCKFILE} is available already`)
|
||||
await install(manifest, opts)
|
||||
|
||||
await cafsHas('@pnpm.e2e/pkg-with-1-dep', '100.0.0')
|
||||
cafsHas('@pnpm.e2e/pkg-with-1-dep', '100.0.0')
|
||||
expect(await exists(path.join(opts.cacheDir, `metadata/localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep.json`))).toBeTruthy()
|
||||
await cafsHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
cafsHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
expect(await exists(path.join(opts.cacheDir, `metadata/localhost+${REGISTRY_MOCK_PORT}/@pnpm.e2e/dep-of-pkg-with-1-dep.json`))).toBeTruthy()
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeFalsy()
|
||||
expect(project.readCurrentLockfile()).toBeFalsy()
|
||||
})
|
||||
|
||||
test('warn when installing with lockfileOnly = true and node_modules exists', async () => {
|
||||
@@ -62,16 +62,16 @@ test('warn when installing with lockfileOnly = true and node_modules exists', as
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await project.storeHas('rimraf', '2.5.1')
|
||||
await project.hasNot('rimraf')
|
||||
project.storeHas('rimraf', '2.5.1')
|
||||
project.hasNot('rimraf')
|
||||
|
||||
expect(manifest.dependencies!.rimraf).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies.rimraf).toBeTruthy()
|
||||
expect(lockfile.packages['/rimraf@2.5.1']).toBeTruthy()
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages['/rimraf@2.5.1']).toBeFalsy()
|
||||
})
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ test('spec not specified in package.json.dependencies', async () => {
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['is-positive'].specifier).toBe('')
|
||||
})
|
||||
|
||||
@@ -162,7 +162,7 @@ test('scoped modules without version spec', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@zkochan/foo'], await testDefaults())
|
||||
|
||||
await project.has('@zkochan/foo')
|
||||
project.has('@zkochan/foo')
|
||||
})
|
||||
|
||||
test('scoped package with custom registry', async () => {
|
||||
@@ -190,7 +190,7 @@ test('modules without version spec, with custom tag config', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/dep-of-pkg-with-1-dep'], await testDefaults({ tag }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('modules without version spec but with a trailing @', async () => {
|
||||
@@ -198,7 +198,7 @@ test('modules without version spec but with a trailing @', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/dep-of-pkg-with-1-dep@'], await testDefaults())
|
||||
|
||||
await project.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('aliased modules without version spec but with a trailing @', async () => {
|
||||
@@ -206,7 +206,7 @@ test('aliased modules without version spec but with a trailing @', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['foo@npm:@pnpm.e2e/dep-of-pkg-with-1-dep@'], await testDefaults())
|
||||
|
||||
await project.has('foo')
|
||||
project.has('foo')
|
||||
})
|
||||
|
||||
test('installing a package by specifying a specific dist-tag', async () => {
|
||||
@@ -217,7 +217,7 @@ test('installing a package by specifying a specific dist-tag', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/dep-of-pkg-with-1-dep@beta'], await testDefaults())
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('update a package when installing with a dist-tag', async () => {
|
||||
@@ -252,8 +252,8 @@ test('update a package when installing with a dist-tag', async () => {
|
||||
name: 'pnpm:root',
|
||||
} as RootLog)).toBeTruthy()
|
||||
|
||||
await project.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
|
||||
expect(manifest.devDependencies!['@pnpm.e2e/dep-of-pkg-with-1-dep']).toBe('^100.1.0')
|
||||
})
|
||||
@@ -262,7 +262,7 @@ test('scoped modules with versions', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@zkochan/foo@1.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.has('@zkochan/foo')
|
||||
project.has('@zkochan/foo')
|
||||
})
|
||||
|
||||
test('multiple scoped modules (@rstacruz/...)', async () => {
|
||||
@@ -319,14 +319,14 @@ test('idempotency', async () => {
|
||||
name: 'pnpm:root',
|
||||
} as RootLog)).toBeFalsy()
|
||||
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('reporting adding root package', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['magic-hook@2.0.0'], await testDefaults())
|
||||
|
||||
await project.storeHas('flatten', '1.0.2')
|
||||
project.storeHas('flatten', '1.0.2')
|
||||
|
||||
const reporter = sinon.spy()
|
||||
|
||||
@@ -347,13 +347,13 @@ test('overwriting (magic-hook@2.0.0 and @0.1.0)', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['magic-hook@2.0.0'], await testDefaults())
|
||||
|
||||
await project.storeHas('flatten', '1.0.2')
|
||||
project.storeHas('flatten', '1.0.2')
|
||||
|
||||
await addDependenciesToPackage(manifest, ['magic-hook@0.1.0'], await testDefaults())
|
||||
|
||||
// flatten is not removed from store even though it is unreferenced
|
||||
// store should be pruned to have this removed
|
||||
await project.storeHas('flatten', '1.0.2')
|
||||
project.storeHas('flatten', '1.0.2')
|
||||
|
||||
const m = project.requireModule('magic-hook/package.json')
|
||||
expect(m.version).toBe('0.1.0')
|
||||
@@ -363,11 +363,11 @@ test('overwriting (is-positive@3.0.0 with is-positive@latest)', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['is-positive@3.0.0'], await testDefaults({ save: true }))
|
||||
|
||||
await project.storeHas('is-positive', '3.0.0')
|
||||
project.storeHas('is-positive', '3.0.0')
|
||||
|
||||
const updatedManifest = await addDependenciesToPackage(manifest, ['is-positive@latest'], await testDefaults({ save: true }))
|
||||
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
expect(updatedManifest.dependencies?.['is-positive']).toBe('3.1.0')
|
||||
})
|
||||
|
||||
@@ -425,7 +425,7 @@ test('refetch package to store if it has been modified', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['magic-hook@2.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const distPathInStore = await project.resolve('magic-hook', '2.0.0', 'dist')
|
||||
const distPathInStore = project.resolve('magic-hook', '2.0.0', 'dist')
|
||||
await rimraf(distPathInStore)
|
||||
await rimraf('node_modules')
|
||||
const distPath = path.resolve('node_modules', 'magic-hook', 'dist')
|
||||
@@ -529,7 +529,7 @@ test('bin specified in the directories property linked to .bin folder', async ()
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-directories-bin'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.isExecutable('.bin/pkg-with-directories-bin')
|
||||
project.isExecutable('.bin/pkg-with-directories-bin')
|
||||
})
|
||||
|
||||
test('bin specified in the directories property symlinked to .bin folder when prefer-symlinked-executables is true on POSIX', async () => {
|
||||
@@ -538,7 +538,7 @@ test('bin specified in the directories property symlinked to .bin folder when pr
|
||||
const opts = await testDefaults({ fastUnpack: false, preferSymlinkedExecutables: true })
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-directories-bin'], opts)
|
||||
|
||||
await project.isExecutable('.bin/pkg-with-directories-bin')
|
||||
project.isExecutable('.bin/pkg-with-directories-bin')
|
||||
|
||||
if (!isWindows()) {
|
||||
const link = await fs.readlink('node_modules/.bin/pkg-with-directories-bin')
|
||||
@@ -553,7 +553,7 @@ testOnNonWindows('building native addons', async () => {
|
||||
|
||||
expect(await exists('node_modules/diskusage/build')).toBeTruthy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/diskusage@1.1.3', 'requiresBuild'], true)
|
||||
})
|
||||
|
||||
@@ -564,9 +564,9 @@ test('should update subdep on second install', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults({ save: true }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
let lockfile = await project.readLockfile()
|
||||
let lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
|
||||
@@ -583,9 +583,9 @@ test('should update subdep on second install', async () => {
|
||||
prefix: process.cwd(),
|
||||
} as StatsLog)).toBeTruthy()
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
|
||||
lockfile = await project.readLockfile()
|
||||
lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
@@ -600,9 +600,9 @@ test('should not update subdep when depth is smaller than depth of package', asy
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults({ save: true }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
let lockfile = await project.readLockfile()
|
||||
let lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
|
||||
@@ -610,9 +610,9 @@ test('should not update subdep when depth is smaller than depth of package', asy
|
||||
|
||||
await install(manifest, await testDefaults({ depth: 0, update: true }))
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
lockfile = await project.readLockfile()
|
||||
lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
@@ -706,7 +706,7 @@ test('lockfile locks npm dependencies', async () => {
|
||||
status: 'fetched',
|
||||
} as ProgressLog)).toBeTruthy()
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' })
|
||||
|
||||
@@ -750,10 +750,10 @@ test('install on project with lockfile and no node_modules', async () => {
|
||||
|
||||
await addDependenciesToPackage(manifest, ['is-positive'], await testDefaults())
|
||||
|
||||
await project.has('is-positive') // installed new dependency
|
||||
project.has('is-positive') // installed new dependency
|
||||
|
||||
// We have to install all other direct dependencies in case they resolve some peers
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test('install a dependency with * range', async () => {
|
||||
@@ -766,7 +766,7 @@ test('install a dependency with * range', async () => {
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
|
||||
await project.has('@pnpm.e2e/has-beta-only')
|
||||
project.has('@pnpm.e2e/has-beta-only')
|
||||
|
||||
expect(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
@@ -796,7 +796,7 @@ test('rewrites node_modules created by npm', async () => {
|
||||
|
||||
const m = project.requireModule('rimraf')
|
||||
expect(typeof m).toEqual('function')
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
|
||||
await execa('npm', ['install', '-f', 'rimraf@2.5.1', '@types/node', '--save'])
|
||||
|
||||
@@ -813,7 +813,7 @@ test("don't fail on case insensitive filesystems when package has 2 files with s
|
||||
const opts = await testDefaults({ reporter })
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/with-same-file-in-different-cases'], opts)
|
||||
|
||||
await project.has('@pnpm.e2e/with-same-file-in-different-cases')
|
||||
project.has('@pnpm.e2e/with-same-file-in-different-cases')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1134
|
||||
@@ -836,14 +836,14 @@ test('reinstalls missing packages to node_modules', async () => {
|
||||
await rimraf('node_modules/is-positive')
|
||||
await rimraf(depLocation)
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
reporter.resetHistory()
|
||||
|
||||
await install(manifest, opts)
|
||||
|
||||
expect(reporter.calledWithMatch(missingDepLog)).toBeTruthy()
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1134
|
||||
@@ -865,14 +865,14 @@ test('reinstalls missing packages to node_modules during headless install', asyn
|
||||
await rimraf('node_modules/is-positive')
|
||||
await rimraf(depLocation)
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
reporter.resetHistory()
|
||||
|
||||
await install(manifest, opts)
|
||||
|
||||
expect(reporter.calledWithMatch(missingDepLog)).toBeTruthy()
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test('do not update deps when lockfile is present', async () => {
|
||||
@@ -881,7 +881,7 @@ test('do not update deps when lockfile is present', async () => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/peer-a'], await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
const initialLockfile = await project.readLockfile()
|
||||
const initialLockfile = project.readLockfile()
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/peer-a', version: '1.0.1', distTag: 'latest' })
|
||||
|
||||
@@ -891,7 +891,7 @@ test('do not update deps when lockfile is present', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ preferFrozenLockfile: false }))
|
||||
|
||||
const latestLockfile = await project.readLockfile()
|
||||
const latestLockfile = project.readLockfile()
|
||||
|
||||
expect(initialLockfile).toStrictEqual(latestLockfile)
|
||||
})
|
||||
@@ -990,7 +990,7 @@ test('subdep symlinks are updated if the lockfile has new subdep versions specif
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(
|
||||
Object.keys(lockfile.packages)
|
||||
@@ -1083,7 +1083,7 @@ test('installing a package that has a manifest with byte order mark (BOM)', asyn
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
await project.has('paralleljs')
|
||||
project.has('paralleljs')
|
||||
})
|
||||
|
||||
test('ignore files in node_modules', async () => {
|
||||
@@ -1159,8 +1159,8 @@ test('installing with no symlinks with PnP', async () => {
|
||||
expect([...await fs.readdir(path.resolve('node_modules'))]).toStrictEqual(['.bin', '.modules.yaml', '.pnpm'])
|
||||
expect([...await fs.readdir(path.resolve('node_modules/.pnpm/rimraf@2.7.1/node_modules'))]).toStrictEqual(['rimraf'])
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
expect(await exists(path.resolve('.pnp.cjs'))).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -1179,7 +1179,7 @@ test('installing with no modules directory', async () => {
|
||||
})
|
||||
)
|
||||
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
expect(await exists(path.resolve('node_modules'))).toBeFalsy()
|
||||
})
|
||||
|
||||
@@ -1232,7 +1232,7 @@ test('installing a package with broken bin', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/broken-bin@1.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
await project.has('@pnpm.e2e/broken-bin')
|
||||
project.has('@pnpm.e2e/broken-bin')
|
||||
})
|
||||
|
||||
test('a package should be able to be a dependency of itself', async () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
import { writeModulesManifest } from '@pnpm/modules-yaml'
|
||||
import { readModulesManifest, writeModulesManifest } from '@pnpm/modules-yaml'
|
||||
import { prepareEmpty } from '@pnpm/prepare'
|
||||
import {
|
||||
addDependenciesToPackage,
|
||||
@@ -18,7 +18,8 @@ test('the modules cache is pruned when it expires', async () => {
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const modulesFile = await project.readModulesManifest()
|
||||
const modulesDir = path.resolve('node_modules')
|
||||
const modulesFile = await readModulesManifest(modulesDir)!
|
||||
|
||||
expect(modulesFile?.prunedAt).toBeTruthy()
|
||||
|
||||
@@ -29,19 +30,19 @@ test('the modules cache is pruned when it expires', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({}))).manifest
|
||||
|
||||
await project.has('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
project.has('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
|
||||
const prunedAt = new Date()
|
||||
prunedAt.setMinutes(prunedAt.getMinutes() - 3)
|
||||
modulesFile!.prunedAt = prunedAt.toString()
|
||||
await writeModulesManifest(path.resolve('node_modules'), modulesFile as any) // eslint-disable-line
|
||||
await writeModulesManifest(modulesDir, modulesFile as any) // eslint-disable-line
|
||||
|
||||
await addDependenciesToPackage(manifest,
|
||||
['is-negative@2.0.0'],
|
||||
await testDefaults({ modulesCacheMaxAge: 2 })
|
||||
)
|
||||
|
||||
await project.hasNot('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
project.hasNot('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
})
|
||||
|
||||
test('the modules cache is pruned when it expires and headless install is used', async () => {
|
||||
@@ -54,7 +55,8 @@ test('the modules cache is pruned when it expires and headless install is used',
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const modulesFile = await project.readModulesManifest()
|
||||
const modulesDir = path.resolve('node_modules')
|
||||
const modulesFile = await readModulesManifest(modulesDir)
|
||||
|
||||
expect(modulesFile?.prunedAt).toBeTruthy()
|
||||
|
||||
@@ -67,14 +69,14 @@ test('the modules cache is pruned when it expires and headless install is used',
|
||||
|
||||
manifest = await install(manifest, await testDefaults({ frozenLockfile: true }))
|
||||
|
||||
await project.has('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
project.has('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
|
||||
const prunedAt = new Date()
|
||||
prunedAt.setMinutes(prunedAt.getMinutes() - 3)
|
||||
modulesFile!.prunedAt = prunedAt.toString()
|
||||
await writeModulesManifest(path.resolve('node_modules'), modulesFile as any) // eslint-disable-line
|
||||
await writeModulesManifest(modulesDir, modulesFile as any) // eslint-disable-line
|
||||
|
||||
await install(manifest, await testDefaults({ frozenLockfile: true, modulesCacheMaxAge: 2 }))
|
||||
|
||||
await project.hasNot('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
project.hasNot('.pnpm/is-negative@1.0.0/node_modules/is-negative')
|
||||
})
|
||||
|
||||
@@ -17,10 +17,10 @@ test('installing to a custom modules directory', async () => {
|
||||
},
|
||||
}, await testDefaults({ modulesDir: 'pnpm_modules' }))
|
||||
|
||||
await project.has('is-positive', 'pnpm_modules')
|
||||
project.has('is-positive', 'pnpm_modules')
|
||||
|
||||
await rimraf('pnpm_modules')
|
||||
await project.hasNot('is-positive', 'pnpm_modules')
|
||||
project.hasNot('is-positive', 'pnpm_modules')
|
||||
|
||||
await install({
|
||||
dependencies: {
|
||||
@@ -28,7 +28,7 @@ test('installing to a custom modules directory', async () => {
|
||||
},
|
||||
}, await testDefaults({ frozenLockfile: true, modulesDir: 'pnpm_modules' }))
|
||||
|
||||
await project.has('is-positive', 'pnpm_modules')
|
||||
project.has('is-positive', 'pnpm_modules')
|
||||
})
|
||||
|
||||
test('using different custom modules directory for every project', async () => {
|
||||
@@ -91,6 +91,6 @@ test('using different custom modules directory for every project', async () => {
|
||||
]
|
||||
await mutateModules(importers, await testDefaults({ allProjects }))
|
||||
|
||||
await projects['project-1'].has('is-positive', 'modules_1')
|
||||
await projects['project-2'].has('is-positive', 'modules_2')
|
||||
projects['project-1'].has('is-positive', 'modules_1')
|
||||
projects['project-2'].has('is-positive', 'modules_2')
|
||||
})
|
||||
|
||||
@@ -73,12 +73,12 @@ test('install only the dependencies of the specified importer', async () => {
|
||||
|
||||
await mutateModules(importers.slice(0, 1), await testDefaults({ allProjects }))
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
await rootModules.has('.pnpm/is-positive@1.0.0')
|
||||
await rootModules.hasNot('.pnpm/is-negative@1.0.0')
|
||||
rootModules.has('.pnpm/is-positive@1.0.0')
|
||||
rootModules.hasNot('.pnpm/is-negative@1.0.0')
|
||||
})
|
||||
|
||||
test('install only the dependencies of the specified importer. The current lockfile has importers that do not exist anymore', async () => {
|
||||
@@ -161,7 +161,7 @@ test('install only the dependencies of the specified importer. The current lockf
|
||||
], await testDefaults({ allProjects, hoistPattern: '*' }))
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const currentLockfile = await rootModules.readCurrentLockfile()
|
||||
const currentLockfile = rootModules.readCurrentLockfile()
|
||||
expect(currentLockfile.importers).toHaveProperty(['project-3'])
|
||||
expect(currentLockfile.packages).toHaveProperty(['/@pnpm.e2e/foobar@100.0.0'])
|
||||
})
|
||||
@@ -294,15 +294,15 @@ test('dependencies of other importers are not pruned when installing for a subse
|
||||
pruneLockfileImporters: false,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
await rootModules.has('.pnpm/is-positive@2.0.0')
|
||||
await rootModules.hasNot('.pnpm/is-positive@1.0.0')
|
||||
await rootModules.has('.pnpm/is-negative@1.0.0')
|
||||
rootModules.has('.pnpm/is-positive@2.0.0')
|
||||
rootModules.hasNot('.pnpm/is-positive@1.0.0')
|
||||
rootModules.has('.pnpm/is-negative@1.0.0')
|
||||
|
||||
const lockfile = await rootModules.readCurrentLockfile()
|
||||
const lockfile = rootModules.readCurrentLockfile()
|
||||
expect(Object.keys(lockfile.importers)).toStrictEqual(['project-1', 'project-2'])
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/is-negative@1.0.0',
|
||||
@@ -373,13 +373,13 @@ test('dependencies of other importers are not pruned when (headless) installing
|
||||
pruneLockfileImporters: false,
|
||||
}))
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
await rootModules.has('.pnpm/is-positive@2.0.0')
|
||||
await rootModules.hasNot('.pnpm/is-positive@1.0.0')
|
||||
await rootModules.has('.pnpm/is-negative@1.0.0')
|
||||
rootModules.has('.pnpm/is-positive@2.0.0')
|
||||
rootModules.hasNot('.pnpm/is-positive@1.0.0')
|
||||
rootModules.has('.pnpm/is-negative@1.0.0')
|
||||
})
|
||||
|
||||
test('adding a new dev dependency to project that uses a shared lockfile', async () => {
|
||||
@@ -465,9 +465,9 @@ test('headless install is used when package linked to another package in the wor
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('headless install is used with an up-to-date lockfile when package references another package via workspace: protocol', async () => {
|
||||
@@ -537,9 +537,9 @@ test('headless install is used with an up-to-date lockfile when package referenc
|
||||
name: 'pnpm',
|
||||
})).toBeTruthy()
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-2'].has('is-negative')
|
||||
})
|
||||
|
||||
test('headless install is used when packages are not linked from the workspace (unless workspace ranges are used)', async () => {
|
||||
@@ -1243,16 +1243,16 @@ test('remove dependencies of a project that was removed from the workspace (duri
|
||||
const project = assertProject(process.cwd())
|
||||
|
||||
{
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(Object.keys(wantedLockfile.importers)).toStrictEqual(['project-1'])
|
||||
expect(Object.keys(wantedLockfile.packages)).toStrictEqual(['/is-positive@1.0.0'])
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(Object.keys(currentLockfile.importers)).toStrictEqual(['project-1', 'project-2'])
|
||||
expect(Object.keys(currentLockfile.packages)).toStrictEqual(['/is-negative@1.0.0', '/is-positive@1.0.0'])
|
||||
|
||||
await project.has('.pnpm/is-positive@1.0.0')
|
||||
await project.has('.pnpm/is-negative@1.0.0')
|
||||
project.has('.pnpm/is-positive@1.0.0')
|
||||
project.has('.pnpm/is-negative@1.0.0')
|
||||
}
|
||||
|
||||
await mutateModules(importers.slice(0, 1), await testDefaults({
|
||||
@@ -1261,12 +1261,12 @@ test('remove dependencies of a project that was removed from the workspace (duri
|
||||
modulesCacheMaxAge: 0,
|
||||
}))
|
||||
{
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(Object.keys(currentLockfile.importers)).toStrictEqual(['project-1'])
|
||||
expect(Object.keys(currentLockfile.packages)).toStrictEqual(['/is-positive@1.0.0'])
|
||||
|
||||
await project.has('.pnpm/is-positive@1.0.0')
|
||||
await project.hasNot('.pnpm/is-negative@1.0.0')
|
||||
project.has('.pnpm/is-positive@1.0.0')
|
||||
project.hasNot('.pnpm/is-negative@1.0.0')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1330,7 +1330,7 @@ test('do not resolve a subdependency from the workspace by default', async () =>
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].dependencies?.['@pnpm.e2e/dep-of-pkg-with-1-dep']).toBe('100.1.0')
|
||||
})
|
||||
|
||||
@@ -1393,7 +1393,7 @@ test('resolve a subdependency from the workspace', async () => {
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].dependencies?.['@pnpm.e2e/dep-of-pkg-with-1-dep']).toBe('link:@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
await rimraf('node_modules')
|
||||
@@ -1474,7 +1474,7 @@ test('resolve a subdependency from the workspace and use it as a peer', async ()
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
const suffix1 = createPeersDirSuffix([{ name: '@pnpm.e2e/peer-a', version: '@pnpm.e2e+peer-a' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }])
|
||||
const suffix2 = createPeersDirSuffix([{ name: '@pnpm.e2e/peer-a', version: '@pnpm.e2e+peer-a' }, { name: '@pnpm.e2e/peer-b', version: '1.0.0' }, { name: '@pnpm.e2e/peer-c', version: '1.0.1' }])
|
||||
expect(Object.keys(wantedLockfile.packages).sort()).toStrictEqual(
|
||||
@@ -1561,7 +1561,7 @@ test('resolve a subdependency from the workspace, when it uses the workspace pro
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].dependencies?.['@pnpm.e2e/dep-of-pkg-with-1-dep']).toBe('link:@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
|
||||
await rimraf('node_modules')
|
||||
@@ -1645,7 +1645,7 @@ test('install the dependency that is already present in the workspace when addin
|
||||
}))
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const currentLockfile = await rootModules.readCurrentLockfile()
|
||||
const currentLockfile = rootModules.readCurrentLockfile()
|
||||
|
||||
expect(currentLockfile.importers['project-1'].dependencies?.['@pnpm.e2e/dep-of-pkg-with-1-dep']).toStrictEqual({
|
||||
specifier: '^100.0.0',
|
||||
@@ -1727,7 +1727,7 @@ test('do not update dependency that has the same name as a dependency in the wor
|
||||
], await testDefaults({ allProjects, linkWorkspacePackagesDepth: -1, workspacePackages, preferredVersions: {} }))
|
||||
|
||||
const rootModules = assertProject(process.cwd())
|
||||
const currentLockfile = await rootModules.readCurrentLockfile()
|
||||
const currentLockfile = rootModules.readCurrentLockfile()
|
||||
expect(Object.keys(currentLockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0',
|
||||
'/is-negative@2.1.0',
|
||||
@@ -1810,7 +1810,7 @@ test('symlink local package from the location described in its publishConfig.dir
|
||||
}
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.importers['project-1'].publishDirectory).toBe('dist')
|
||||
|
||||
await rimraf('node_modules')
|
||||
|
||||
@@ -30,10 +30,10 @@ test('production install (with --production flag)', async () => {
|
||||
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@zkochan/foo@1.0.0'))).toBeFalsy()
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/js-yaml@3.14.0'))).toBeTruthy()
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await project.has('write-yaml')
|
||||
await project.hasNot('@zkochan/foo')
|
||||
await project.hasNot('js-yaml')
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.has('write-yaml')
|
||||
project.hasNot('@zkochan/foo')
|
||||
project.hasNot('js-yaml')
|
||||
})
|
||||
|
||||
test('production install with --no-optional', async () => {
|
||||
@@ -62,10 +62,10 @@ test('production install with --no-optional', async () => {
|
||||
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@zkochan/foo@1.0.0'))).toBeFalsy()
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/js-yaml@3.14.0'))).toBeTruthy()
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
await project.has('write-yaml')
|
||||
await project.hasNot('@zkochan/foo')
|
||||
await project.hasNot('js-yaml')
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.has('write-yaml')
|
||||
project.hasNot('@zkochan/foo')
|
||||
project.hasNot('js-yaml')
|
||||
})
|
||||
|
||||
test('install dev dependencies only', async () => {
|
||||
@@ -87,26 +87,26 @@ test('install dev dependencies only', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.has('inflight')
|
||||
await project.hasNot('once')
|
||||
project.has('inflight')
|
||||
project.hasNot('once')
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/is-positive@1.0.0'].dev === false).toBeTruthy()
|
||||
}
|
||||
|
||||
{
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages['/is-positive@1.0.0']).toBeFalsy()
|
||||
}
|
||||
|
||||
// Repeat normal installation adds missing deps to node_modules
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
await project.has('once')
|
||||
project.has('once')
|
||||
|
||||
{
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages['/is-positive@1.0.0']).toBeTruthy()
|
||||
}
|
||||
})
|
||||
@@ -133,8 +133,8 @@ test('fail if installing different types of dependencies in a project that uses
|
||||
lockfileDir,
|
||||
}))
|
||||
|
||||
await project.has('inflight')
|
||||
await project.hasNot('once')
|
||||
project.has('inflight')
|
||||
project.hasNot('once')
|
||||
|
||||
const newOpts = await testDefaults({
|
||||
confirmModulesPurge: false,
|
||||
@@ -163,5 +163,5 @@ test('installation should not fail if a linked dependency points to a directory
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
@@ -52,9 +52,9 @@ test('skip non-existing optional dependency', async () => {
|
||||
reason: 'resolution_failure',
|
||||
})).toBeTruthy()
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.dependencies['is-positive'].specifier).toBe('1.0.0')
|
||||
})
|
||||
@@ -69,11 +69,11 @@ test('skip optional dependency that does not support the current OS', async () =
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
await project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@pnpm.e2e+dep-of-optional-pkg@1.0.0'))).toBeFalsy()
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/not-compatible-with-any-os@1.0.0']).toBeTruthy()
|
||||
|
||||
// optional dependencies always get requiresBuild: true
|
||||
@@ -82,7 +82,7 @@ test('skip optional dependency that does not support the current OS', async () =
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/dep-of-optional-pkg@1.0.0']).toBeTruthy()
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
|
||||
expect(currentLockfile.packages).toStrictEqual(lockfile.packages)
|
||||
|
||||
@@ -107,10 +107,10 @@ test('skip optional dependency that does not support the current OS', async () =
|
||||
|
||||
manifest = await addDependenciesToPackage(manifest, ['@pnpm.e2e/dep-of-optional-pkg'], await testDefaults())
|
||||
|
||||
await project.has('@pnpm.e2e/dep-of-optional-pkg')
|
||||
project.has('@pnpm.e2e/dep-of-optional-pkg')
|
||||
|
||||
{
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'])
|
||||
}
|
||||
|
||||
@@ -122,11 +122,11 @@ test('skip optional dependency that does not support the current OS', async () =
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ frozenLockfile: true }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
await project.has('@pnpm.e2e/dep-of-optional-pkg')
|
||||
project.hasNot('@pnpm.e2e/not-compatible-with-any-os')
|
||||
project.has('@pnpm.e2e/dep-of-optional-pkg')
|
||||
|
||||
{
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules?.skipped).toStrictEqual(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'])
|
||||
}
|
||||
})
|
||||
@@ -141,8 +141,8 @@ test('skip optional dependency that does not support the current Node version',
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/for-legacy-node')
|
||||
await project.storeHas('@pnpm.e2e/for-legacy-node', '1.0.0')
|
||||
project.hasNot('@pnpm.e2e/for-legacy-node')
|
||||
project.storeHas('@pnpm.e2e/for-legacy-node', '1.0.0')
|
||||
|
||||
const logMatcher = sinon.match({
|
||||
package: {
|
||||
@@ -170,8 +170,8 @@ test('skip optional dependency that does not support the current pnpm version',
|
||||
pnpmVersion: '4.0.0',
|
||||
}))
|
||||
|
||||
await project.hasNot('@pnpm.e2e/for-legacy-pnpm')
|
||||
await project.storeHas('@pnpm.e2e/for-legacy-pnpm', '1.0.0')
|
||||
project.hasNot('@pnpm.e2e/for-legacy-pnpm')
|
||||
project.storeHas('@pnpm.e2e/for-legacy-pnpm', '1.0.0')
|
||||
|
||||
const logMatcher = sinon.match({
|
||||
package: {
|
||||
@@ -194,8 +194,8 @@ test('don\'t skip optional dependency that does not support the current OS when
|
||||
},
|
||||
}, await testDefaults({}, {}, {}, { force: true }))
|
||||
|
||||
await project.has('@pnpm.e2e/not-compatible-with-any-os')
|
||||
await project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
project.has('@pnpm.e2e/not-compatible-with-any-os')
|
||||
project.storeHas('@pnpm.e2e/not-compatible-with-any-os', '1.0.0')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/2636
|
||||
@@ -306,7 +306,7 @@ test('optional subdependency is skipped', async () => {
|
||||
}, await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(Object.keys(lockfile.packages).length).toBe(3)
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'])
|
||||
@@ -338,7 +338,7 @@ test('optional subdependency of newly added optional dependency is skipped', asy
|
||||
const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml'))
|
||||
expect(modulesInfo.skipped).toStrictEqual(['/@pnpm.e2e/dep-of-optional-pkg@1.0.0', '/@pnpm.e2e/not-compatible-with-any-os@1.0.0'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(Object.keys(lockfile.packages).length).toBe(3)
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'])
|
||||
@@ -359,7 +359,7 @@ test('only that package is skipped which is an optional dependency only and not
|
||||
expect(modulesInfo.skipped).toStrictEqual([])
|
||||
}
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(typeof lockfile.packages['/@pnpm.e2e/dep-of-optional-pkg@1.0.0'].optional).toBe('undefined')
|
||||
|
||||
await rimraf('node_modules')
|
||||
@@ -397,8 +397,8 @@ test('not installing optional dependencies when optional is false', async () =>
|
||||
})
|
||||
)
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
await project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
project.hasNot('is-positive')
|
||||
project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
|
||||
expect(deepRequireCwd(['@pnpm.e2e/pkg-with-good-optional', '@pnpm.e2e/dep-of-pkg-with-1-dep', './package.json'])).toBeTruthy()
|
||||
expect(deepRequireCwd.silent(['@pnpm.e2e/pkg-with-good-optional', 'is-positive', './package.json'])).toBeFalsy()
|
||||
@@ -532,7 +532,7 @@ test('do not fail on unsupported dependency of optional dependency', async () =>
|
||||
await testDefaults({ targetDependenciesField: 'optionalDependencies' }, {}, {}, { engineStrict: true })
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/not-compatible-with-any-os@1.0.0'].optional).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/dep-of-optional-pkg@1.0.0']).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ test('versions are replaced with versions specified through overrides option', a
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/foobarqar@1.0.0'].dependencies?.['@pnpm.e2e/foo']).toBe('/@pnpm.e2e/qar@100.0.0')
|
||||
expect(lockfile.packages['/@pnpm.e2e/foobar@100.0.0'].dependencies?.['@pnpm.e2e/foo']).toBe('100.0.0')
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@101.0.0'])
|
||||
@@ -33,7 +33,7 @@ test('versions are replaced with versions specified through overrides option', a
|
||||
'@pnpm.e2e/bar@^100.0.0': '100.1.0',
|
||||
'@pnpm.e2e/dep-of-pkg-with-1-dep': '101.0.0',
|
||||
})
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.overrides).toStrictEqual(currentLockfile.overrides)
|
||||
}
|
||||
// shall be able to install when package manifest is ignored
|
||||
@@ -54,7 +54,7 @@ test('versions are replaced with versions specified through overrides option', a
|
||||
}, await testDefaults({ overrides }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@101.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/bar@100.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foobarqar@1.0.1'])
|
||||
@@ -64,7 +64,7 @@ test('versions are replaced with versions specified through overrides option', a
|
||||
'@pnpm.e2e/bar@^100.0.0': '100.0.0',
|
||||
'@pnpm.e2e/dep-of-pkg-with-1-dep': '101.0.0',
|
||||
})
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.overrides).toStrictEqual(currentLockfile.overrides)
|
||||
}
|
||||
|
||||
@@ -75,14 +75,14 @@ test('versions are replaced with versions specified through overrides option', a
|
||||
}, await testDefaults({ frozenLockfile: true, overrides }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.overrides).toStrictEqual({
|
||||
'@pnpm.e2e/foobarqar': '1.0.1',
|
||||
'@pnpm.e2e/foobarqar>@pnpm.e2e/foo': 'npm:@pnpm.e2e/qar@100.0.0',
|
||||
'@pnpm.e2e/bar@^100.0.0': '100.0.0',
|
||||
'@pnpm.e2e/dep-of-pkg-with-1-dep': '101.0.0',
|
||||
})
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.overrides).toStrictEqual(currentLockfile.overrides)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/is-positive@1.0.0'].dependencies?.['@pnpm.e2e/bar']).toBe('100.1.0')
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(createObjectChecksum({
|
||||
'is-positive': {
|
||||
@@ -33,7 +33,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
},
|
||||
},
|
||||
}))
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(currentLockfile.packageExtensionsChecksum)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
}, await testDefaults({ packageExtensions }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/is-positive@1.0.0'].dependencies?.['@pnpm.e2e/foobar']).toBe('100.0.0')
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(createObjectChecksum({
|
||||
'is-positive': {
|
||||
@@ -56,7 +56,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
},
|
||||
},
|
||||
}))
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(currentLockfile.packageExtensionsChecksum)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
}, await testDefaults({ frozenLockfile: true, packageExtensions }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(createObjectChecksum({
|
||||
'is-positive': {
|
||||
dependencies: {
|
||||
@@ -76,7 +76,7 @@ test('manifests are extended with fields specified by packageExtensions', async
|
||||
},
|
||||
},
|
||||
}))
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(lockfile.packageExtensionsChecksum).toStrictEqual(currentLockfile.packageExtensionsChecksum)
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ test('packageExtensionsChecksum does not change regardless of keys order', async
|
||||
await install(manifest(), await testDefaults({
|
||||
packageExtensions: packageExtensions1,
|
||||
}))
|
||||
const lockfile1 = await project.readLockfile()
|
||||
const lockfile1 = project.readLockfile()
|
||||
const checksum1 = lockfile1.packageExtensionsChecksum
|
||||
|
||||
await install(manifest(), await testDefaults({
|
||||
packageExtensions: packageExtensions2,
|
||||
}))
|
||||
const lockfile2 = await project.readLockfile()
|
||||
const lockfile2 = project.readLockfile()
|
||||
const checksum2 = lockfile2.packageExtensionsChecksum
|
||||
|
||||
expect(checksum1).toBe(checksum2)
|
||||
@@ -155,7 +155,7 @@ test('manifests are patched by extensions from the compatibility database', asyn
|
||||
await testDefaults()
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/debug@4.0.0'].peerDependenciesMeta?.['supports-color']?.optional).toBe(true)
|
||||
})
|
||||
|
||||
@@ -170,6 +170,6 @@ test('manifests are not patched by extensions from the compatibility database wh
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/debug@4.0.0'].peerDependenciesMeta).toBeUndefined()
|
||||
})
|
||||
|
||||
@@ -33,7 +33,7 @@ test('patch package', async () => {
|
||||
expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// patched')
|
||||
|
||||
const patchFileHash = 'jnbpamcxayl5i4ehrkoext3any'
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.patchedDependencies).toStrictEqual({
|
||||
'is-positive@1.0.0': {
|
||||
path: path.relative(process.cwd(), patchedDependencies['is-positive@1.0.0']).replaceAll('\\', '/'),
|
||||
@@ -200,7 +200,7 @@ test('patch package when scripts are ignored', async () => {
|
||||
expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// patched')
|
||||
|
||||
const patchFileHash = 'jnbpamcxayl5i4ehrkoext3any'
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.patchedDependencies).toStrictEqual({
|
||||
'is-positive@1.0.0': {
|
||||
path: path.relative(process.cwd(), patchedDependencies['is-positive@1.0.0']).replaceAll('\\', '/'),
|
||||
@@ -287,7 +287,7 @@ test('patch package when the package is not in onlyBuiltDependencies list', asyn
|
||||
expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// patched')
|
||||
|
||||
const patchFileHash = 'jnbpamcxayl5i4ehrkoext3any'
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.patchedDependencies).toStrictEqual({
|
||||
'is-positive@1.0.0': {
|
||||
path: path.relative(process.cwd(), patchedDependencies['is-positive@1.0.0']).replaceAll('\\', '/'),
|
||||
@@ -376,7 +376,7 @@ test('patch package when the patched package has no dependencies and appears mul
|
||||
|
||||
expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// patched')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/is-not-positive@1.0.0',
|
||||
'/is-positive@1.0.0(patch_hash=jnbpamcxayl5i4ehrkoext3any)',
|
||||
|
||||
@@ -47,7 +47,7 @@ test('peer dependency is grouped with dependency when peer is resolved not from
|
||||
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/using-ajv'], await testDefaults({ update: true }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/using-ajv@1.0.0'].dependencies!['ajv-keywords']).toBe('1.5.0(ajv@4.10.4)')
|
||||
// covers https://github.com/pnpm/pnpm/issues/1150
|
||||
@@ -99,7 +99,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ preferFrozenLockfile: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/ajv-keywords@1.5.0(ajv@4.10.4)'].dependencies).toHaveProperty(['ajv'])
|
||||
})
|
||||
|
||||
@@ -309,7 +309,7 @@ test('peer dependency is resolved from the dependencies of the workspace root pr
|
||||
}))
|
||||
|
||||
{
|
||||
const lockfile = await projects.root.readLockfile()
|
||||
const lockfile = projects.root.readLockfile()
|
||||
expect(lockfile.importers.pkg?.dependencies?.['ajv-keywords'].version).toBe('1.5.0(ajv@4.10.0)')
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ test('peer dependency is resolved from the dependencies of the workspace root pr
|
||||
], await testDefaults({ allProjects, reporter, resolvePeersFromWorkspaceRoot: true }))
|
||||
|
||||
{
|
||||
const lockfile = await projects.root.readLockfile()
|
||||
const lockfile = projects.root.readLockfile()
|
||||
expect(lockfile.importers.pkg?.dependencies?.['ajv-keywords'].version).toBe('1.5.0(ajv@4.10.0)')
|
||||
}
|
||||
})
|
||||
@@ -505,7 +505,7 @@ test('the list of transitive peer dependencies is kept up to date', async () =>
|
||||
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@pnpm.e2e+abc-grand-parent@1.0.0_@pnpm.e2e+peer-c@1.0.0/node_modules/@pnpm.e2e/abc-grand-parent'))).toBeTruthy()
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/abc-grand-parent@1.0.0(@pnpm.e2e/peer-c@1.0.0)'].transitivePeerDependencies).toStrictEqual(['@pnpm.e2e/peer-c'])
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ test('the list of transitive peer dependencies is kept up to date', async () =>
|
||||
expect(await exists(path.resolve('node_modules/.pnpm/@pnpm.e2e+abc-grand-parent@1.0.0/node_modules/@pnpm.e2e/abc-grand-parent'))).toBeTruthy()
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/abc-grand-parent@1.0.0'].transitivePeerDependencies).toBeFalsy()
|
||||
}
|
||||
})
|
||||
@@ -643,7 +643,7 @@ test.skip('peer dependencies are linked', async () => {
|
||||
expect(deepRequireCwd(['@pnpm.e2e/abc-parent-with-ab', '@pnpm.e2e/abc', '@pnpm.e2e/peer-c', './package.json']).version).toBe('2.0.0')
|
||||
expect(deepRequireCwd(['@pnpm.e2e/abc-grand-parent-with-c', '@pnpm.e2e/abc-parent-with-ab', '@pnpm.e2e/abc', '@pnpm.e2e/peer-c', './package.json']).version).toBe('1.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/abc-parent-with-ab/1.0.0/@pnpm.e2e/peer-a@1.0.0+@pnpm.e2e+peer-b@1.0.0'].dev).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -664,9 +664,9 @@ test('peer bins are linked', async () => {
|
||||
const suffix = createPeersDirSuffix([{ name: '@pnpm.e2e/peer-with-bin', version: '1.0.0' }])
|
||||
const pkgVariation = path.join('.pnpm', depPathToFilename(`/@pnpm.e2e/pkg-with-peer-having-bin@1.0.0${suffix}`), 'node_modules')
|
||||
|
||||
await project.isExecutable(path.join(pkgVariation, '@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin', 'peer-with-bin'))
|
||||
project.isExecutable(path.join(pkgVariation, '@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin', 'peer-with-bin'))
|
||||
|
||||
await project.isExecutable(path.join(pkgVariation, '@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin', 'hello-world-js-bin'))
|
||||
project.isExecutable(path.join(pkgVariation, '@pnpm.e2e/pkg-with-peer-having-bin/node_modules/.bin', 'hello-world-js-bin'))
|
||||
})
|
||||
|
||||
test('run pre/postinstall scripts of each variations of packages with peer dependencies', async () => {
|
||||
@@ -687,7 +687,7 @@ test('package that has parent as peer dependency', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/has-alpha', '@pnpm.e2e/alpha'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/has-alpha-as-peer@1.0.0(@pnpm.e2e/alpha@1.0.0)'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/has-alpha-as-peer@1.0.0'])
|
||||
@@ -1090,7 +1090,7 @@ test('warning is not reported when cannot resolve optional peer dependency', asy
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/abc-optional-peers@1.0.0(@pnpm.e2e/peer-c@2.0.0)'].peerDependenciesMeta).toStrictEqual({
|
||||
'@pnpm.e2e/peer-b': {
|
||||
@@ -1153,7 +1153,7 @@ test('warning is not reported when cannot resolve optional peer dependency (spec
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/abc-optional-peers-meta-only@1.0.0(@pnpm.e2e/peer-c@2.0.0)'].peerDependencies).toStrictEqual({
|
||||
'@pnpm.e2e/peer-a': '^1.0.0',
|
||||
@@ -1218,7 +1218,7 @@ test('peer dependency that is resolved by a dev dependency', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ fastUnpack: false, lockfileOnly: true, strictPeerDependencies: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@types/mongoose@5.7.32'].dev).toBeUndefined()
|
||||
|
||||
await mutateModulesInSingleProject({
|
||||
@@ -1234,8 +1234,8 @@ test('peer dependency that is resolved by a dev dependency', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.has('@typegoose/typegoose')
|
||||
await project.hasNot('@types/mongoose')
|
||||
project.has('@typegoose/typegoose')
|
||||
project.hasNot('@types/mongoose')
|
||||
})
|
||||
|
||||
test('peer dependency is grouped with dependency when peer is resolved not from a top dependency 2', async () => {
|
||||
@@ -1673,7 +1673,7 @@ test('resolve peer of peer from the dependencies of the direct dependent package
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/has-has-y-peer-only-as-peer-and-y@1.0.0', '@pnpm/y@2.0.0'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.dependencies['@pnpm.e2e/has-has-y-peer-only-as-peer-and-y'].version).toBe('1.0.0(@pnpm.e2e/has-y-peer@1.0.0(@pnpm/y@2.0.0))')
|
||||
// Even though @pnpm/y@1.0.0 is in the dependencies of the direct dependent package, we resolve y from above.
|
||||
@@ -1685,7 +1685,7 @@ test('2 circular peers', async () => {
|
||||
const project = prepareEmpty()
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/circular-peer-a@1.0.0', '@pnpm.e2e/circular-peer-b@1.0.0'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.dependencies['@pnpm.e2e/circular-peer-a'].version).toBe('1.0.0(@pnpm.e2e/circular-peer-b@1.0.0)')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/circular-peer-b'].version).toBe('1.0.0(@pnpm.e2e/circular-peer-a@1.0.0)')
|
||||
@@ -1700,7 +1700,7 @@ test('3 circular peers', async () => {
|
||||
'@pnpm.e2e/peer-a@1.0.0',
|
||||
], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.dependencies['@pnpm.e2e/circular-peers-1-of-3'].version).toBe('1.0.0(@pnpm.e2e/circular-peers-2-of-3@1.0.0)(@pnpm.e2e/peer-a@1.0.0)')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/circular-peers-2-of-3'].version).toBe('1.0.0(@pnpm.e2e/circular-peers-3-of-3@1.0.0)(@pnpm.e2e/peer-a@1.0.0)(@pnpm.e2e/peer-b@1.0.0)')
|
||||
@@ -1759,7 +1759,7 @@ test('3 circular peers in workspace root', async () => {
|
||||
},
|
||||
], await testDefaults({ allProjects, reporter, autoInstallPeers: false, resolvePeersFromWorkspaceRoot: true, strictPeerDependencies: false }))
|
||||
|
||||
const lockfile = await projects.root.readLockfile()
|
||||
const lockfile = projects.root.readLockfile()
|
||||
expect(lockfile.importers.pkg?.dependencies?.['@pnpm.e2e/circular-peers-1-of-3'].version).toBe('1.0.0(@pnpm.e2e/circular-peers-2-of-3@1.0.0(@pnpm.e2e/circular-peers-3-of-3@1.0.0)(@pnpm.e2e/peer-a@1.0.0))(@pnpm.e2e/peer-a@1.0.0)')
|
||||
})
|
||||
|
||||
@@ -1783,6 +1783,6 @@ test('do not fail when the same package with peer dependency is installed via di
|
||||
], await testDefaults({
|
||||
autoInstallPeers: true,
|
||||
}))
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages).length).toBe(2)
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ test('reports warning when installing deprecated packages', async () => {
|
||||
pkgId: '/express@0.14.1',
|
||||
} as DeprecationLog))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/express@0.14.1'].deprecated).toBe('express 0.x series is deprecated')
|
||||
|
||||
reporter.mockReset()
|
||||
|
||||
@@ -8,7 +8,7 @@ test('time-based resolution mode', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/bravo', '@pnpm.e2e/romeo'], await testDefaults({ resolutionMode: 'time-based' }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/bravo-dep@1.0.1',
|
||||
'/@pnpm.e2e/bravo@1.0.0',
|
||||
@@ -25,7 +25,7 @@ test('time-based resolution mode with a registry that supports the time field in
|
||||
resolutionMode: 'time-based',
|
||||
}))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/@pnpm.e2e/bravo-dep@1.0.1',
|
||||
'/@pnpm.e2e/bravo@1.0.0',
|
||||
@@ -45,14 +45,14 @@ test('the lowest version of a direct dependency is installed when resolution mod
|
||||
}, await testDefaults({ resolutionMode: 'time-based' }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@100.0.0']).toBeTruthy()
|
||||
}
|
||||
|
||||
manifest = await install(manifest, await testDefaults({ resolutionMode: 'time-based', update: true }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@100.1.0']).toBeTruthy()
|
||||
}
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
@@ -77,7 +77,7 @@ test('the lowest version of a direct dependency is installed when resolution mod
|
||||
}, await testDefaults({ resolutionMode: 'lowest-direct' }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0']).toBeTruthy()
|
||||
}
|
||||
@@ -85,7 +85,7 @@ test('the lowest version of a direct dependency is installed when resolution mod
|
||||
manifest = await install(manifest, await testDefaults({ resolutionMode: 'lowest-direct', update: true }))
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.1.0']).toBeTruthy()
|
||||
}
|
||||
expect(manifest.dependencies).toStrictEqual({
|
||||
|
||||
@@ -54,20 +54,20 @@ test.skip('caching side effects of native package when hoisting is used', async
|
||||
const cacheBuildDir = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
const stat1 = await fs.stat(cacheBuildDir)
|
||||
|
||||
await project.has('.pnpm/node_modules/diskusage/build') // build folder created
|
||||
project.has('.pnpm/node_modules/diskusage/build') // build folder created
|
||||
expect(await exists(cacheBuildDir)).toBeTruthy() // build folder created in side effects cache
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
|
||||
await addDependenciesToPackage(manifest, ['expire-fs@2.2.3'], opts)
|
||||
const stat2 = await fs.stat(cacheBuildDir)
|
||||
expect(stat1.ino).toBe(stat2.ino) // existing cache is not overridden
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
|
||||
opts.force = true
|
||||
await addDependenciesToPackage(manifest, ['expire-fs@2.2.3'], opts)
|
||||
const stat3 = await fs.stat(cacheBuildDir)
|
||||
expect(stat1.ino).not.toBe(stat3.ino) // cache is overridden when force is true
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
})
|
||||
|
||||
test('using side effects cache', async () => {
|
||||
|
||||
@@ -21,5 +21,5 @@ test('repeat install with corrupted `store.json` should work', async () => {
|
||||
|
||||
await install(manifest, opts)
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ test('preserve subdeps on update', async () => {
|
||||
|
||||
await install(manifest, await testDefaults({ update: true, depth: 0 }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toBeTruthy()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/abc-parent-with-ab@1.0.0(@pnpm.e2e/peer-c@1.0.0)'])
|
||||
@@ -67,7 +67,7 @@ test('preserve subdeps on update when no node_modules is present', async () => {
|
||||
|
||||
await install(manifest, await testDefaults({ update: true, depth: 0 }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toBeTruthy()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/abc-parent-with-ab@1.0.0(@pnpm.e2e/peer-c@1.0.0)']) // preserve version of package that has resolved peer deps
|
||||
@@ -95,7 +95,7 @@ test('update does not install the package if it is not present in package.json',
|
||||
update: true,
|
||||
}))
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('update dependency when external lockfile directory is used', async () => {
|
||||
@@ -141,7 +141,7 @@ test('preserve subdeps when installing on a package that has one dependency spec
|
||||
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/abc-parent-with-ab@1.0.0(@pnpm.e2e/peer-c@1.0.0)']) // preserve version of package that has resolved peer deps
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foobarqar@1.0.1'])
|
||||
@@ -168,7 +168,7 @@ test('update only the packages that were requested to be updated when hoisting i
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ '@pnpm.e2e/bar': '^100.0.0', '@pnpm.e2e/foo': '^100.1.0' })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual(['/@pnpm.e2e/bar@100.0.0', '/@pnpm.e2e/foo@100.1.0'])
|
||||
})
|
||||
|
||||
@@ -200,7 +200,7 @@ test('update only the specified package', async () => {
|
||||
updateMatching: (pkgName: string) => pkgName === '@pnpm.e2e/foo',
|
||||
}))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/abc-parent-with-ab@1.0.0(@pnpm.e2e/peer-c@1.0.0)'])
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foobarqar@1.0.0'])
|
||||
|
||||
@@ -11,7 +11,7 @@ test('save to package.json (is-positive@^1.0.0)', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['is-positive@^1.0.0'], await testDefaults({ save: true }))
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'is-positive': '^1.0.0' })
|
||||
})
|
||||
@@ -72,7 +72,7 @@ test('dependency should not be added to package.json if it is already there', as
|
||||
},
|
||||
})
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.devDependencies['@pnpm.e2e/foo'].version).toBe('100.0.0')
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@100.0.0'].dev).toBeTruthy()
|
||||
@@ -150,7 +150,7 @@ test('dependency should be removed from the old field when installing it as a di
|
||||
})
|
||||
|
||||
{
|
||||
const lockfile = await project.readCurrentLockfile()
|
||||
const lockfile = project.readCurrentLockfile()
|
||||
expect(Object.keys(lockfile.dependencies)).toStrictEqual(['@pnpm.e2e/bar', '@pnpm.e2e/foo', '@pnpm.e2e/qar'])
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ test('dependency should be removed from the old field when installing it as a di
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
{
|
||||
const lockfile = await project.readCurrentLockfile()
|
||||
const lockfile = project.readCurrentLockfile()
|
||||
expect(Object.keys(lockfile.devDependencies)).toStrictEqual(['@pnpm.e2e/bar', '@pnpm.e2e/foo', '@pnpm.e2e/qar'])
|
||||
expect(lockfile.dependencies).toBeFalsy()
|
||||
}
|
||||
@@ -172,8 +172,8 @@ test('multiple save to package.json with `exact` versions (@rstacruz/tap-spec &
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({}, ['is-positive@1.0.0', '@zkochan/foo@latest'], await testDefaults({ save: true, pinnedVersion: 'patch' }))
|
||||
|
||||
await project.has('@zkochan/foo')
|
||||
await project.has('is-positive')
|
||||
project.has('@zkochan/foo')
|
||||
project.has('is-positive')
|
||||
|
||||
const expectedDeps = {
|
||||
'@zkochan/foo': '1.0.0',
|
||||
|
||||
@@ -32,15 +32,15 @@ test('relative link', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.dependencies['@pnpm.e2e/hello-world-js-bin']).toStrictEqual({
|
||||
version: 'link:../hello-world-js-bin',
|
||||
specifier: '*',
|
||||
})
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.dependencies['@pnpm.e2e/hello-world-js-bin']).toStrictEqual({
|
||||
version: 'link:../hello-world-js-bin',
|
||||
specifier: '*',
|
||||
@@ -61,11 +61,11 @@ test('relative link is linked by the name of the alias', async () => {
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
await project.has('hello')
|
||||
project.has('hello')
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.dependencies).toStrictEqual({
|
||||
hello: {
|
||||
specifier: 'link:../hello-world-js-bin',
|
||||
@@ -153,10 +153,10 @@ test('relative link is rewritten by named installation to regular dependency', a
|
||||
|
||||
expect(project.requireModule('@pnpm.e2e/hello-world-js-bin/package.json').isLocal).toBeFalsy()
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.dependencies['@pnpm.e2e/hello-world-js-bin'].version).toBe('1.0.0')
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.dependencies['@pnpm.e2e/hello-world-js-bin'].version).toBe('1.0.0')
|
||||
})
|
||||
|
||||
@@ -234,9 +234,9 @@ test('link should not change the type of the dependency', async () => {
|
||||
},
|
||||
}))
|
||||
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.devDependencies).toStrictEqual({
|
||||
'@pnpm.e2e/hello-world-js-bin': {
|
||||
version: 'link:../hello-world-js-bin',
|
||||
|
||||
@@ -46,11 +46,11 @@ test('lockfile has correct format', async () => {
|
||||
'kevva/is-negative#1d7e288222b53a0cab90a331f1865220ec29560c',
|
||||
], await testDefaults({ fastUnpack: false, save: true }))
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
expect(modules).toBeTruthy()
|
||||
expect(modules!.pendingBuilds.length).toBe(0)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const id = '/@pnpm.e2e/pkg-with-1-dep@100.0.0'
|
||||
|
||||
expect(lockfile.lockfileVersion).toBe(LOCKFILE_VERSION)
|
||||
@@ -82,7 +82,7 @@ test('lockfile has dev deps even when installing for prod only', async () => {
|
||||
},
|
||||
}, await testDefaults({ production: true }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
const id = '/is-negative@2.1.0'
|
||||
|
||||
expect(lockfile.devDependencies).toBeTruthy()
|
||||
@@ -141,7 +141,7 @@ test("lockfile doesn't lock subdependencies that don't satisfy the new specs", a
|
||||
project.requireModule('.pnpm/react-datetime@1.3.0/node_modules/react-onclickoutside/package.json').version
|
||||
).toBe('0.3.4') // react-datetime@1.3.0 has react-onclickoutside@0.3.4 in its node_modules
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(Object.keys(lockfile.dependencies).length).toBe(1) // resolutions not duplicated
|
||||
})
|
||||
@@ -151,7 +151,7 @@ test('a lockfile created even when there are no deps in package.json', async ()
|
||||
|
||||
await install({}, await testDefaults())
|
||||
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
expect(await exists('node_modules')).toBeFalsy()
|
||||
})
|
||||
|
||||
@@ -177,7 +177,7 @@ test('current lockfile removed when no deps in package.json', async () => {
|
||||
|
||||
await install({}, await testDefaults())
|
||||
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
expect(await exists('node_modules')).toBeFalsy()
|
||||
})
|
||||
|
||||
@@ -235,7 +235,7 @@ test('lockfile is fixed when it does not match package.json', async () => {
|
||||
})
|
||||
expect(reporter.withArgs(progress).callCount).toBe(0)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.devDependencies['is-negative'].version).toBe('2.1.0')
|
||||
expect(lockfile.optionalDependencies['is-positive'].version).toBe('3.1.0')
|
||||
@@ -294,7 +294,7 @@ test(`doing named installation when ${WANTED_LOCKFILE} exists already`, async ()
|
||||
|
||||
expect(reporter.calledWithMatch(LOCKFILE_WARN_LOG)).toBeFalsy()
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test(`respects ${WANTED_LOCKFILE} for top dependencies`, async () => {
|
||||
@@ -342,7 +342,7 @@ test(`respects ${WANTED_LOCKFILE} for top dependencies`, async () => {
|
||||
|
||||
// t.equal(reporter.withArgs(fooProgress).callCount, 0, 'not reported foo')
|
||||
|
||||
await project.storeHasNot('@pnpm.e2e/foo', '100.1.0')
|
||||
project.storeHasNot('@pnpm.e2e/foo', '100.1.0')
|
||||
expect((await readPackageJsonFromDir(path.resolve('node_modules', '@pnpm.e2e/foo'))).version).toBe('100.0.0')
|
||||
expect((await readPackageJsonFromDir(path.resolve('node_modules', '@pnpm.e2e/bar'))).version).toBe('100.0.0')
|
||||
expect((await readPackageJsonFromDir(path.resolve('node_modules', '@pnpm.e2e/qar'))).version).toBe('100.0.0')
|
||||
@@ -358,9 +358,9 @@ test(`subdeps are updated on repeat install if outer ${WANTED_LOCKFILE} does not
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults())
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
|
||||
@@ -378,7 +378,7 @@ test(`subdeps are updated on repeat install if outer ${WANTED_LOCKFILE} does not
|
||||
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
})
|
||||
|
||||
test("recreates lockfile if it doesn't match the dependencies in package.json", async () => {
|
||||
@@ -388,7 +388,7 @@ test("recreates lockfile if it doesn't match the dependencies in package.json",
|
||||
manifest = await addDependenciesToPackage(manifest, ['is-positive@1.0.0'], await testDefaults({ pinnedVersion: 'patch', targetDependenciesField: 'devDependencies' }))
|
||||
manifest = await addDependenciesToPackage(manifest, ['map-obj@1.0.0'], await testDefaults({ pinnedVersion: 'patch', targetDependenciesField: 'optionalDependencies' }))
|
||||
|
||||
const lockfile1 = await project.readLockfile()
|
||||
const lockfile1 = project.readLockfile()
|
||||
expect(lockfile1.dependencies['is-negative'].version).toBe('1.0.0')
|
||||
expect(lockfile1.dependencies['is-negative'].specifier).toBe('1.0.0')
|
||||
|
||||
@@ -398,7 +398,7 @@ test("recreates lockfile if it doesn't match the dependencies in package.json",
|
||||
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.dependencies['is-negative'].version).toBe('2.1.0')
|
||||
expect(lockfile.dependencies['is-negative'].specifier).toBe('^2.1.0')
|
||||
@@ -415,7 +415,7 @@ test('repeat install with lockfile should not mutate lockfile when dependency ha
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['highmaps-release@5.0.11'], await testDefaults())
|
||||
|
||||
const lockfile1 = await project.readLockfile()
|
||||
const lockfile1 = project.readLockfile()
|
||||
|
||||
expect(lockfile1.dependencies['highmaps-release'].version).toBe('5.0.11')
|
||||
|
||||
@@ -423,7 +423,7 @@ test('repeat install with lockfile should not mutate lockfile when dependency ha
|
||||
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
const lockfile2 = await project.readLockfile()
|
||||
const lockfile2 = project.readLockfile()
|
||||
|
||||
expect(lockfile1).toStrictEqual(lockfile2) // lockfile hasn't been changed
|
||||
})
|
||||
@@ -442,7 +442,7 @@ test('package is not marked dev if it is also a subdep of a regular dependency',
|
||||
|
||||
console.log('installed optional dependency which is also a dependency of @pnpm.e2e/pkg-with-1-dep')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'].dev).toBeFalsy()
|
||||
})
|
||||
@@ -456,7 +456,7 @@ test('package is not marked optional if it is also a subdep of a regular depende
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults())
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/dep-of-pkg-with-1-dep'], await testDefaults({ targetDependenciesField: 'optionalDependencies' }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'].optional).toBeFalsy()
|
||||
})
|
||||
@@ -470,9 +470,9 @@ test('scoped module from different registry', async () => {
|
||||
opts.registries!['@foo'] = `http://localhost:${REGISTRY_MOCK_PORT}`
|
||||
await addDependenciesToPackage({}, ['@zkochan/foo', '@foo/has-dep-from-same-scope', 'is-positive'], opts)
|
||||
|
||||
await project.has('@zkochan/foo')
|
||||
project.has('@zkochan/foo')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -548,7 +548,7 @@ test('repeat install with no inner lockfile should not rewrite packages in node_
|
||||
|
||||
await install(manifest, await testDefaults())
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test('packages are placed in devDependencies even if they are present as non-dev as well', async () => {
|
||||
@@ -565,7 +565,7 @@ test('packages are placed in devDependencies even if they are present as non-dev
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.devDependencies).toHaveProperty(['@pnpm.e2e/dep-of-pkg-with-1-dep'])
|
||||
expect(lockfile.devDependencies).toHaveProperty(['@pnpm.e2e/pkg-with-1-dep'])
|
||||
@@ -615,14 +615,14 @@ test('pendingBuilds gets updated if install removes packages', async () => {
|
||||
'@pnpm.e2e/with-postinstall-b': '*',
|
||||
},
|
||||
}, await testDefaults({ fastUnpack: false, ignoreScripts: true }))
|
||||
const modules1 = await project.readModulesManifest()
|
||||
const modules1 = project.readModulesManifest()
|
||||
|
||||
await install({
|
||||
dependencies: {
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example': '*',
|
||||
},
|
||||
}, await testDefaults({ fastUnpack: false, ignoreScripts: true }))
|
||||
const modules2 = await project.readModulesManifest()
|
||||
const modules2 = project.readModulesManifest()
|
||||
|
||||
expect(modules1).toBeTruthy()
|
||||
expect(modules2).toBeTruthy()
|
||||
@@ -639,7 +639,7 @@ test('dev properties are correctly updated on named install', async () => {
|
||||
)
|
||||
await addDependenciesToPackage(manifest, ['foo@npm:inflight@1.0.6'], await testDefaults({}))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(
|
||||
Object.values(lockfile.packages).filter((dep) => typeof dep.dev !== 'undefined')
|
||||
).toStrictEqual([])
|
||||
@@ -651,7 +651,7 @@ test('optional properties are correctly updated on named install', async () => {
|
||||
const manifest = await addDependenciesToPackage({}, ['inflight@1.0.6'], await testDefaults({ targetDependenciesField: 'optionalDependencies' }))
|
||||
await addDependenciesToPackage(manifest, ['foo@npm:inflight@1.0.6'], await testDefaults({}))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.values(lockfile.packages).filter((dep) => typeof dep.optional !== 'undefined')).toStrictEqual([])
|
||||
})
|
||||
|
||||
@@ -661,7 +661,7 @@ test('dev property is correctly set for package that is duplicated to both the d
|
||||
// TODO: use a smaller package for testing
|
||||
await addDependenciesToPackage({}, ['overlap@2.2.8'], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/couleurs@5.0.0'].dev === false).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -673,9 +673,9 @@ test('no lockfile', async () => {
|
||||
|
||||
expect(reporter.calledWithMatch(LOCKFILE_WARN_LOG)).toBeFalsy()
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
expect(await project.readLockfile()).toBeFalsy()
|
||||
expect(project.readLockfile()).toBeFalsy()
|
||||
})
|
||||
|
||||
test('lockfile is ignored when lockfile = false', async () => {
|
||||
@@ -709,9 +709,9 @@ test('lockfile is ignored when lockfile = false', async () => {
|
||||
|
||||
expect(reporter.calledWithMatch(LOCKFILE_WARN_LOG)).toBeTruthy()
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
})
|
||||
|
||||
test(`don't update ${WANTED_LOCKFILE} during uninstall when useLockfile: false`, async () => {
|
||||
@@ -739,9 +739,9 @@ test(`don't update ${WANTED_LOCKFILE} during uninstall when useLockfile: false`,
|
||||
expect(reporter.calledWithMatch(LOCKFILE_WARN_LOG)).toBeTruthy()
|
||||
}
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
expect(await project.readLockfile()).toBeTruthy()
|
||||
expect(project.readLockfile()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('fail when installing with useLockfile: false and lockfileOnly: true', async () => {
|
||||
@@ -761,8 +761,8 @@ test("don't remove packages during named install when useLockfile: false", async
|
||||
const manifest = await addDependenciesToPackage({}, ['is-positive'], await testDefaults({ useLockfile: false }))
|
||||
await addDependenciesToPackage(manifest, ['is-negative'], await testDefaults({ useLockfile: false }))
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
project.has('is-positive')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test('save tarball URL when it is non-standard', async () => {
|
||||
@@ -770,7 +770,7 @@ test('save tarball URL when it is non-standard', async () => {
|
||||
|
||||
await addDependenciesToPackage({}, ['esprima-fb@3001.1.0-dev-harmony-fb'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect((lockfile.packages['/esprima-fb@3001.1.0-dev-harmony-fb'].resolution as TarballResolution).tarball).toBe(`http://localhost:${REGISTRY_MOCK_PORT}/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz`)
|
||||
})
|
||||
@@ -783,7 +783,7 @@ test('packages installed via tarball URL from the default registry are normalize
|
||||
'https://registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz',
|
||||
], await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -1008,8 +1008,8 @@ test(`doing named installation when shared ${WANTED_LOCKFILE} exists already`, a
|
||||
})
|
||||
)
|
||||
|
||||
await projects['pkg1'].has('is-negative')
|
||||
await projects['pkg2'].has('is-positive')
|
||||
projects['pkg1'].has('is-negative')
|
||||
projects['pkg2'].has('is-positive')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1200
|
||||
@@ -1022,8 +1022,8 @@ test(`use current ${WANTED_LOCKFILE} as initial wanted one, when wanted was remo
|
||||
|
||||
await addDependenciesToPackage(manifest, ['underscore@1.9.1'], await testDefaults())
|
||||
|
||||
await project.has('lodash')
|
||||
await project.has('underscore')
|
||||
project.has('lodash')
|
||||
project.has('underscore')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1876
|
||||
@@ -1035,7 +1035,7 @@ test('existing dependencies are preserved when updating a lockfile to a newer fo
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults())
|
||||
|
||||
const initialLockfile = await project.readLockfile()
|
||||
const initialLockfile = project.readLockfile()
|
||||
await writeYamlFile(WANTED_LOCKFILE, { ...initialLockfile, lockfileVersion: 5.01 }, { lineWidth: 1000 })
|
||||
|
||||
await addDistTag({ package: '@pnpm.e2e/dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' })
|
||||
@@ -1046,7 +1046,7 @@ test('existing dependencies are preserved when updating a lockfile to a newer fo
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults())
|
||||
|
||||
const updatedLockfile = await project.readLockfile()
|
||||
const updatedLockfile = project.readLockfile()
|
||||
|
||||
expect(initialLockfile.packages).toStrictEqual(updatedLockfile.packages)
|
||||
})
|
||||
@@ -1058,7 +1058,7 @@ test('broken lockfile is fixed even if it seems like up to date at first. Unless
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep'], await testDefaults({ lockfileOnly: true }))
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
delete lockfile.packages['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0']
|
||||
await writeYamlFile(WANTED_LOCKFILE, lockfile, { lineWidth: 1000 })
|
||||
@@ -1082,8 +1082,8 @@ test('broken lockfile is fixed even if it seems like up to date at first. Unless
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ preferFrozenLockfile: true }))
|
||||
|
||||
await project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
const lockfile = await project.readLockfile()
|
||||
project.has('@pnpm.e2e/pkg-with-1-dep')
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
})
|
||||
|
||||
@@ -1118,7 +1118,7 @@ test('tarball domain differs from registry domain', async () => {
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -1165,7 +1165,7 @@ test('tarball installed through non-standard URL endpoint from the registry doma
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile).toStrictEqual({
|
||||
settings: {
|
||||
@@ -1228,7 +1228,7 @@ packages:
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('100.1.0')
|
||||
})
|
||||
|
||||
@@ -1266,7 +1266,7 @@ packages:
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep']).toHaveProperty('version', '100.1.0')
|
||||
})
|
||||
|
||||
@@ -1295,7 +1295,7 @@ packages:
|
||||
},
|
||||
}, await testDefaults({ reporter }))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('100.0.0')
|
||||
|
||||
expect(reporter).toBeCalledWith(expect.objectContaining({
|
||||
@@ -1384,7 +1384,7 @@ test('build metadata is always ignored in versions and the lockfile is not flick
|
||||
], await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
const depPath = '/@monorepolint/core@0.5.0-alpha.51'
|
||||
const initialLockfile = await project.readLockfile()
|
||||
const initialLockfile = project.readLockfile()
|
||||
const initialPkgEntry = initialLockfile.packages[depPath]
|
||||
expect(initialPkgEntry?.resolution).toStrictEqual({
|
||||
integrity: 'sha512-ihFonHDppOZyG717OW6Bamd37mI2gQHjd09buTjbKhRX8NAHsTbRUKwp39ZYVI5AYgLF1eDlLpgOY4dHy2xGQw==',
|
||||
@@ -1392,7 +1392,7 @@ test('build metadata is always ignored in versions and the lockfile is not flick
|
||||
|
||||
await addDependenciesToPackage(manifest, ['is-positive'], await testDefaults({ lockfileOnly: true }))
|
||||
|
||||
const updatedLockfile = await project.readLockfile()
|
||||
const updatedLockfile = project.readLockfile()
|
||||
expect(initialPkgEntry).toStrictEqual(updatedLockfile.packages[depPath])
|
||||
})
|
||||
|
||||
@@ -1433,7 +1433,7 @@ test('include tarball URL', async () => {
|
||||
const opts = await testDefaults({ fastUnpack: false, lockfileIncludeTarballUrl: true })
|
||||
await addDependenciesToPackage({}, ['@pnpm.e2e/pkg-with-1-dep@100.0.0'], opts)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect((lockfile.packages['/@pnpm.e2e/pkg-with-1-dep@100.0.0'].resolution as TarballResolution).tarball)
|
||||
.toBe(`http://localhost:${REGISTRY_MOCK_PORT}/@pnpm.e2e/pkg-with-1-dep/-/pkg-with-1-dep-100.0.0.tgz`)
|
||||
})
|
||||
|
||||
@@ -38,5 +38,5 @@ test('successful offline installation', async () => {
|
||||
|
||||
await install(manifest, await testDefaults({}, { offline: true }, { offline: true }))
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ test('copy does not fail on package that self-requires itself', async () => {
|
||||
const m = project.requireModule('@pnpm.e2e/requires-itself/package.json')
|
||||
expect(m).toBeTruthy() // requires-itself is available with packageImportMethod = copy
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/requires-itself@1.0.0'].dependencies).toStrictEqual({ 'is-positive': '1.0.0' })
|
||||
})
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ test('prune removes extraneous packages', async () => {
|
||||
manifest = await addDependenciesToPackage(manifest, ['is-positive@2.0.0', '@zkochan/logger@0.1.0'], opts)
|
||||
manifest = await link([linkedPkg], path.resolve('node_modules'), { ...opts, manifest, dir: process.cwd() })
|
||||
|
||||
await project.has('@pnpm.e2e/hello-world-js-bin') // external link added
|
||||
project.has('@pnpm.e2e/hello-world-js-bin') // external link added
|
||||
|
||||
delete manifest.dependencies!['is-positive']
|
||||
delete manifest.dependencies!['@zkochan/logger']
|
||||
@@ -52,22 +52,22 @@ test('prune removes extraneous packages', async () => {
|
||||
},
|
||||
} as RootLog)).toBeTruthy()
|
||||
|
||||
await project.hasNot('@pnpm.e2e/hello-world-js-bin') // external link pruned
|
||||
project.hasNot('@pnpm.e2e/hello-world-js-bin') // external link pruned
|
||||
|
||||
await project.storeHasNot('is-positive', '2.0.0')
|
||||
await project.hasNot('is-positive')
|
||||
project.storeHasNot('is-positive', '2.0.0')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
await project.storeHasNot('@zkochan/logger', '0.1.0')
|
||||
await project.hasNot('@zkochan/logger')
|
||||
project.storeHasNot('@zkochan/logger', '0.1.0')
|
||||
project.hasNot('@zkochan/logger')
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
await project.has('is-negative')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
project.has('is-negative')
|
||||
|
||||
await project.storeHas('applyq', '0.2.1')
|
||||
await project.has('applyq')
|
||||
project.storeHas('applyq', '0.2.1')
|
||||
project.has('applyq')
|
||||
|
||||
await project.storeHas('fnumber', '0.1.0')
|
||||
await project.has('fnumber')
|
||||
project.storeHas('fnumber', '0.1.0')
|
||||
project.has('fnumber')
|
||||
})
|
||||
|
||||
test('prune removes dev dependencies in production', async () => {
|
||||
@@ -85,12 +85,12 @@ test('prune removes dev dependencies in production', async () => {
|
||||
pruneStore: true,
|
||||
}))
|
||||
|
||||
await project.storeHasNot('is-positive', '2.0.0')
|
||||
await project.hasNot('is-positive')
|
||||
project.storeHasNot('is-positive', '2.0.0')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
await project.has('is-negative')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
project.has('is-negative')
|
||||
|
||||
await project.storeHas('fnumber', '0.1.0')
|
||||
await project.has('fnumber')
|
||||
project.storeHas('fnumber', '0.1.0')
|
||||
project.has('fnumber')
|
||||
})
|
||||
|
||||
@@ -73,9 +73,9 @@ test('uninstall package with no dependencies', async () => {
|
||||
|
||||
// uninstall does not remove packages from store
|
||||
// even if they become unreferenced
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
|
||||
await project.hasNot('is-negative')
|
||||
project.hasNot('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -110,9 +110,9 @@ test('uninstall scoped package', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ save: true }))).manifest
|
||||
|
||||
await project.storeHas('@zkochan/logger', '0.1.0')
|
||||
project.storeHas('@zkochan/logger', '0.1.0')
|
||||
|
||||
await project.hasNot('@zkochan/logger')
|
||||
project.hasNot('@zkochan/logger')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -129,8 +129,8 @@ test('uninstall tarball dependency', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, opts)).manifest
|
||||
|
||||
await project.storeHas('is-array', '1.0.1')
|
||||
await project.hasNot('is-array')
|
||||
project.storeHas('is-array', '1.0.1')
|
||||
project.hasNot('is-array')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({})
|
||||
})
|
||||
@@ -145,21 +145,21 @@ test('uninstall package with dependencies and do not touch other deps', async ()
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ pruneStore: true, save: true }))).manifest
|
||||
|
||||
await project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
await project.hasNot('camelcase-keys')
|
||||
project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
project.hasNot('camelcase-keys')
|
||||
|
||||
await project.storeHasNot('camelcase', '3.0.0')
|
||||
await project.hasNot('camelcase')
|
||||
project.storeHasNot('camelcase', '3.0.0')
|
||||
project.hasNot('camelcase')
|
||||
|
||||
await project.storeHasNot('map-obj', '1.0.1')
|
||||
await project.hasNot('map-obj')
|
||||
project.storeHasNot('map-obj', '1.0.1')
|
||||
project.hasNot('map-obj')
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
await project.has('is-negative')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
project.has('is-negative')
|
||||
|
||||
expect(manifest.dependencies).toStrictEqual({ 'is-negative': '2.1.0' })
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies).toStrictEqual({
|
||||
'is-negative': {
|
||||
specifier: '2.1.0',
|
||||
@@ -203,7 +203,7 @@ test('relative link is uninstalled', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, opts)
|
||||
|
||||
await project.hasNot(linkedPkgName)
|
||||
project.hasNot(linkedPkgName)
|
||||
})
|
||||
|
||||
test('pendingBuilds gets updated after uninstall', async () => {
|
||||
@@ -214,7 +214,7 @@ test('pendingBuilds gets updated after uninstall', async () => {
|
||||
await testDefaults({ fastUnpack: false, save: true, ignoreScripts: true })
|
||||
)
|
||||
|
||||
const modules1 = await project.readModulesManifest()
|
||||
const modules1 = project.readModulesManifest()
|
||||
expect(modules1).toBeTruthy()
|
||||
expect(modules1!.pendingBuilds.length).toBe(2)
|
||||
|
||||
@@ -225,7 +225,7 @@ test('pendingBuilds gets updated after uninstall', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults({ save: true }))
|
||||
|
||||
const modules2 = await project.readModulesManifest()
|
||||
const modules2 = project.readModulesManifest()
|
||||
expect(modules2).toBeTruthy()
|
||||
expect(modules2!.pendingBuilds.length).toBe(1)
|
||||
})
|
||||
@@ -297,8 +297,8 @@ test('uninstalling a dependency from package that uses shared lockfile', async (
|
||||
})
|
||||
)
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
await mutateModulesInSingleProject({
|
||||
dependencyNames: ['is-positive', 'project-2'],
|
||||
@@ -311,8 +311,8 @@ test('uninstalling a dependency from package that uses shared lockfile', async (
|
||||
pruneLockfileImporters: false,
|
||||
}))
|
||||
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
const lockfile = await readYamlFile<Lockfile>(WANTED_LOCKFILE)
|
||||
|
||||
@@ -352,7 +352,7 @@ test('uninstall remove modules that is not in package.json', async () => {
|
||||
|
||||
await writeJsonFile('node_modules/foo/package.json', { name: 'foo', version: '1.0.0' })
|
||||
|
||||
await project.has('foo')
|
||||
project.has('foo')
|
||||
|
||||
await mutateModulesInSingleProject({
|
||||
dependencyNames: ['foo'],
|
||||
@@ -361,5 +361,5 @@ test('uninstall remove modules that is not in package.json', async () => {
|
||||
rootDir: process.cwd(),
|
||||
}, await testDefaults())
|
||||
|
||||
await project.hasNot('foo')
|
||||
project.hasNot('foo')
|
||||
})
|
||||
|
||||
@@ -42,12 +42,12 @@ test('installing a simple project', async () => {
|
||||
expect(project.requireModule('is-negative')).toBeTruthy()
|
||||
expect(project.requireModule('colors')).toBeTruthy()
|
||||
|
||||
await project.has('.pnpm/colors@1.2.0')
|
||||
project.has('.pnpm/colors@1.2.0')
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
|
||||
expect(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
@@ -107,12 +107,12 @@ test('installing only prod deps', async () => {
|
||||
}))
|
||||
|
||||
const project = assertProject(prefix)
|
||||
await project.has('is-positive')
|
||||
await project.has('rimraf')
|
||||
await project.hasNot('is-negative')
|
||||
await project.hasNot('colors')
|
||||
project.has('is-positive')
|
||||
project.has('rimraf')
|
||||
project.hasNot('is-negative')
|
||||
project.hasNot('colors')
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
})
|
||||
|
||||
test('installing only dev deps', async () => {
|
||||
@@ -128,10 +128,10 @@ test('installing only dev deps', async () => {
|
||||
}))
|
||||
|
||||
const project = assertProject(prefix)
|
||||
await project.hasNot('is-positive')
|
||||
await project.hasNot('rimraf')
|
||||
await project.has('is-negative')
|
||||
await project.hasNot('colors')
|
||||
project.hasNot('is-positive')
|
||||
project.hasNot('rimraf')
|
||||
project.has('is-negative')
|
||||
project.hasNot('colors')
|
||||
})
|
||||
|
||||
test('installing with package manifest ignored', async () => {
|
||||
@@ -149,13 +149,13 @@ test('installing with package manifest ignored', async () => {
|
||||
await headlessInstall({ ...opt, ignorePackageManifest: true })
|
||||
|
||||
const project = assertProject(prefix)
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
expect(currentLockfile.packages).toHaveProperty(['/is-negative@2.1.0'])
|
||||
await project.storeHas('is-negative')
|
||||
await project.storeHas('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
await project.hasNot('is-positive')
|
||||
project.storeHas('is-negative')
|
||||
project.storeHas('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('installing only prod package with package manifest ignored', async () => {
|
||||
@@ -173,13 +173,13 @@ test('installing only prod package with package manifest ignored', async () => {
|
||||
await headlessInstall({ ...opt, ignorePackageManifest: true })
|
||||
|
||||
const project = assertProject(prefix)
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages).not.toHaveProperty(['/is-negative@2.1.0'])
|
||||
expect(currentLockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHas('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
await project.hasNot('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHas('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('installing only dev package with package manifest ignored', async () => {
|
||||
@@ -197,13 +197,13 @@ test('installing only dev package with package manifest ignored', async () => {
|
||||
await headlessInstall({ ...opt, ignorePackageManifest: true })
|
||||
|
||||
const project = assertProject(prefix)
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages).toHaveProperty(['/is-negative@2.1.0'])
|
||||
expect(currentLockfile.packages).not.toHaveProperty(['/is-positive@1.0.0'])
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHas('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
await project.hasNot('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHas('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('installing non-prod deps then all deps', async () => {
|
||||
@@ -222,15 +222,15 @@ test('installing non-prod deps then all deps', async () => {
|
||||
const inflight = project.requireModule('inflight')
|
||||
expect(typeof inflight).toBe('function')
|
||||
|
||||
await project.hasNot('once')
|
||||
project.hasNot('once')
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/is-positive@1.0.0'].dev === false).toBeTruthy()
|
||||
}
|
||||
|
||||
{
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages).not.toHaveProperty(['/is-positive@1.0.0'])
|
||||
}
|
||||
|
||||
@@ -266,10 +266,10 @@ test('installing non-prod deps then all deps', async () => {
|
||||
name: 'pnpm:root',
|
||||
} as RootLog)).toBeFalsy()
|
||||
|
||||
await project.has('once')
|
||||
project.has('once')
|
||||
|
||||
{
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
}
|
||||
})
|
||||
@@ -290,10 +290,10 @@ test('installing only optional deps', async () => {
|
||||
}))
|
||||
|
||||
const project = assertProject(prefix)
|
||||
await project.hasNot('is-positive')
|
||||
await project.hasNot('rimraf')
|
||||
await project.hasNot('is-negative')
|
||||
await project.has('colors')
|
||||
project.hasNot('is-positive')
|
||||
project.hasNot('rimraf')
|
||||
project.hasNot('is-negative')
|
||||
project.has('colors')
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1958
|
||||
@@ -310,8 +310,8 @@ test('not installing optional deps', async () => {
|
||||
}))
|
||||
|
||||
const project = assertProject(prefix)
|
||||
await project.hasNot('is-positive')
|
||||
await project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
project.hasNot('is-positive')
|
||||
project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
})
|
||||
|
||||
test('skipping optional dependency if it cannot be fetched', async () => {
|
||||
@@ -332,8 +332,8 @@ test('skipping optional dependency if it cannot be fetched', async () => {
|
||||
expect(project.requireModule('rimraf')).toBeTruthy()
|
||||
expect(project.requireModule('is-negative')).toBeTruthy()
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('run pre/postinstall scripts', async () => {
|
||||
@@ -395,10 +395,10 @@ test('orphan packages are removed', async () => {
|
||||
} as StatsLog)).toBeTruthy()
|
||||
|
||||
const project = assertProject(projectDir)
|
||||
await project.hasNot('resolve-from')
|
||||
await project.has('rimraf')
|
||||
await project.has('is-negative')
|
||||
await project.has('colors')
|
||||
project.hasNot('resolve-from')
|
||||
project.has('rimraf')
|
||||
project.has('is-negative')
|
||||
project.has('colors')
|
||||
})
|
||||
|
||||
test('available packages are used when node_modules is not clean', async () => {
|
||||
@@ -421,8 +421,8 @@ test('available packages are used when node_modules is not clean', async () => {
|
||||
await headlessInstall(await testDefaults({ lockfileDir: projectDir, reporter }))
|
||||
|
||||
const project = assertProject(projectDir)
|
||||
await project.has('rimraf')
|
||||
await project.has('glob')
|
||||
project.has('rimraf')
|
||||
project.has('glob')
|
||||
|
||||
expect(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
@@ -458,8 +458,8 @@ test('available packages are relinked during forced install', async () => {
|
||||
await headlessInstall(await testDefaults({ lockfileDir: projectDir, reporter, force: true }))
|
||||
|
||||
const project = assertProject(projectDir)
|
||||
await project.has('rimraf')
|
||||
await project.has('glob')
|
||||
project.has('rimraf')
|
||||
project.has('glob')
|
||||
|
||||
expect(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
@@ -534,7 +534,7 @@ test('install peer dependencies that are in prod dependencies', async () => {
|
||||
|
||||
const project = assertProject(prefix)
|
||||
|
||||
await project.has('.pnpm/@pnpm.e2e+peer-a@1.0.1/node_modules/@pnpm.e2e/peer-a')
|
||||
project.has('.pnpm/@pnpm.e2e+peer-a@1.0.1/node_modules/@pnpm.e2e/peer-a')
|
||||
})
|
||||
|
||||
test('installing with hoistPattern=*', async () => {
|
||||
@@ -550,13 +550,13 @@ test('installing with hoistPattern=*', async () => {
|
||||
expect(project.requireModule('is-negative')).toBeTruthy()
|
||||
expect(project.requireModule('colors')).toBeTruthy()
|
||||
|
||||
await project.has('.pnpm/colors@1.2.0')
|
||||
project.has('.pnpm/colors@1.2.0')
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
await project.isExecutable('.pnpm/node_modules/.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.pnpm/node_modules/.bin/hello-world-js-bin')
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
|
||||
expect(reporter).toBeCalledWith(expect.objectContaining({
|
||||
level: 'debug',
|
||||
@@ -591,7 +591,7 @@ test('installing with hoistPattern=*', async () => {
|
||||
status: 'resolved',
|
||||
}))
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
|
||||
expect(modules!.hoistedDependencies['/balanced-match@1.0.2']).toStrictEqual({ 'balanced-match': 'private' })
|
||||
})
|
||||
@@ -609,13 +609,13 @@ test('installing with publicHoistPattern=*', async () => {
|
||||
expect(project.requireModule('is-negative')).toBeTruthy()
|
||||
expect(project.requireModule('colors')).toBeTruthy()
|
||||
|
||||
await project.has('.pnpm/colors@1.2.0')
|
||||
project.has('.pnpm/colors@1.2.0')
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
|
||||
expect(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
@@ -647,7 +647,7 @@ test('installing with publicHoistPattern=*', async () => {
|
||||
status: 'resolved',
|
||||
})).toBeTruthy()
|
||||
|
||||
const modules = await project.readModulesManifest()
|
||||
const modules = project.readModulesManifest()
|
||||
|
||||
expect(modules!.hoistedDependencies['/balanced-match@1.0.2']).toStrictEqual({ 'balanced-match': 'public' })
|
||||
})
|
||||
@@ -723,7 +723,7 @@ test.skip('using side effects cache and hoistPattern=*', async () => {
|
||||
await headlessInstall(opts)
|
||||
|
||||
const project = assertProject(lockfileDir)
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
|
||||
const cacheBuildDir = path.join(opts.storeDir, `diskusage@1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
writeFileSync(path.join(cacheBuildDir, 'new-file.txt'), 'some new content')
|
||||
@@ -733,7 +733,7 @@ test.skip('using side effects cache and hoistPattern=*', async () => {
|
||||
|
||||
expect(await exists(path.join(lockfileDir, 'node_modules/.pnpm/node_modules/diskusage/build/new-file.txt'))).toBeTruthy()
|
||||
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
})
|
||||
|
||||
test('installing in a workspace', async () => {
|
||||
@@ -751,7 +751,7 @@ test('installing in a workspace', async () => {
|
||||
|
||||
const projectBar = assertProject(path.join(workspaceFixture, 'bar'))
|
||||
|
||||
await projectBar.has('foo')
|
||||
projectBar.has('foo')
|
||||
|
||||
await headlessInstall(await testDefaults({
|
||||
lockfileDir: workspaceFixture,
|
||||
@@ -759,7 +759,7 @@ test('installing in a workspace', async () => {
|
||||
}))
|
||||
|
||||
const rootModules = assertProject(workspaceFixture)
|
||||
const lockfile = await rootModules.readCurrentLockfile()
|
||||
const lockfile = rootModules.readCurrentLockfile()
|
||||
expect(Object.keys(lockfile.packages)).toStrictEqual([
|
||||
'/is-negative@1.0.0',
|
||||
'/is-positive@1.0.0',
|
||||
@@ -779,8 +779,8 @@ test('installing with no symlinks but with PnP', async () => {
|
||||
expect([...await fs.readdir(path.join(prefix, 'node_modules/.pnpm/rimraf@2.7.1/node_modules'))]).toStrictEqual(['rimraf'])
|
||||
|
||||
const project = assertProject(prefix)
|
||||
expect(await project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(await project.readModulesManifest()).toBeTruthy()
|
||||
expect(project.readCurrentLockfile()).toBeTruthy()
|
||||
expect(project.readModulesManifest()).toBeTruthy()
|
||||
expect(await exists(path.join(prefix, '.pnp.cjs'))).toBeTruthy()
|
||||
})
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ test('installing with "workspace:" should work even if link-workspace-packages i
|
||||
|
||||
expect(pkg?.dependencies).toStrictEqual({ 'project-2': 'workspace:^2.0.0' })
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('installing with "workspace:" should work even if link-workspace-packages is off and save-workspace-protocol is "rolling"', async () => {
|
||||
@@ -90,7 +90,7 @@ test('installing with "workspace:" should work even if link-workspace-packages i
|
||||
|
||||
expect(pkg?.dependencies).toStrictEqual({ 'project-2': 'workspace:^' })
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('installing with "workspace=true" should work even if link-workspace-packages is off and save-workspace-protocol is false', async () => {
|
||||
@@ -118,7 +118,7 @@ test('installing with "workspace=true" should work even if link-workspace-packag
|
||||
|
||||
expect(pkg?.dependencies).toStrictEqual({ 'project-2': 'workspace:^2.0.0' })
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('add: fail when "workspace" option is true but the command runs not in a workspace', async () => {
|
||||
@@ -207,7 +207,7 @@ test('installing with "workspace=true" with linkWorkspacePackages on and saveWor
|
||||
|
||||
expect(pkg?.dependencies).toStrictEqual({ 'project-2': '^2.0.0' })
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('add: fail when --no-save option is used', async () => {
|
||||
@@ -254,7 +254,7 @@ test('pnpm add --save-peer', async () => {
|
||||
)
|
||||
}
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
await remove.handler({
|
||||
...DEFAULT_OPTIONS,
|
||||
@@ -262,7 +262,7 @@ test('pnpm add --save-peer', async () => {
|
||||
linkWorkspacePackages: false,
|
||||
}, ['is-positive'])
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
{
|
||||
const manifest = await loadJsonFile(path.resolve('package.json'))
|
||||
@@ -329,7 +329,7 @@ test('pnpm add automatically installs missing peer dependencies', async () => {
|
||||
linkWorkspacePackages: false,
|
||||
}, ['@pnpm.e2e/abc@1.0.0'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(Object.keys(lockfile.packages).length).toBe(5)
|
||||
})
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ test('recursive add --save-dev, --save-peer on workspace with multiple lockfiles
|
||||
{ 'is-negative': '1.0.0' }
|
||||
)
|
||||
expect(
|
||||
(await projects['project-1'].readLockfile()).devDependencies
|
||||
(projects['project-1'].readLockfile()).devDependencies
|
||||
).toStrictEqual(
|
||||
{
|
||||
'is-positive': {
|
||||
@@ -80,7 +80,7 @@ test('recursive add --save-dev, --save-peer on workspace with multiple lockfiles
|
||||
{ 'is-negative': '1.0.0' }
|
||||
)
|
||||
expect(
|
||||
(await projects['project-2'].readLockfile()).devDependencies
|
||||
(projects['project-2'].readLockfile()).devDependencies
|
||||
).toStrictEqual(
|
||||
{
|
||||
'is-positive': {
|
||||
|
||||
@@ -52,8 +52,8 @@ test('fetch dependencies', async () => {
|
||||
await rimraf(path.resolve(project.dir(), 'node_modules'))
|
||||
await rimraf(path.resolve(project.dir(), './package.json'))
|
||||
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHasNot('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHasNot('is-positive')
|
||||
|
||||
await fetch.handler({
|
||||
...DEFAULT_OPTIONS,
|
||||
@@ -62,8 +62,8 @@ test('fetch dependencies', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.storeHas('is-positive')
|
||||
await project.storeHas('is-negative')
|
||||
project.storeHas('is-positive')
|
||||
project.storeHas('is-negative')
|
||||
})
|
||||
|
||||
test('fetch production dependencies', async () => {
|
||||
@@ -83,8 +83,8 @@ test('fetch production dependencies', async () => {
|
||||
await rimraf(path.resolve(project.dir(), 'node_modules'))
|
||||
await rimraf(path.resolve(project.dir(), './package.json'))
|
||||
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHasNot('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHasNot('is-positive')
|
||||
|
||||
await fetch.handler({
|
||||
...DEFAULT_OPTIONS,
|
||||
@@ -94,8 +94,8 @@ test('fetch production dependencies', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHas('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHas('is-positive')
|
||||
})
|
||||
|
||||
test('fetch only dev dependencies', async () => {
|
||||
@@ -115,8 +115,8 @@ test('fetch only dev dependencies', async () => {
|
||||
await rimraf(path.resolve(project.dir(), 'node_modules'))
|
||||
await rimraf(path.resolve(project.dir(), './package.json'))
|
||||
|
||||
await project.storeHasNot('is-negative')
|
||||
await project.storeHasNot('is-positive')
|
||||
project.storeHasNot('is-negative')
|
||||
project.storeHasNot('is-positive')
|
||||
|
||||
await fetch.handler({
|
||||
...DEFAULT_OPTIONS,
|
||||
@@ -126,6 +126,6 @@ test('fetch only dev dependencies', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.storeHas('is-negative')
|
||||
await project.storeHasNot('is-positive')
|
||||
project.storeHas('is-negative')
|
||||
project.storeHasNot('is-positive')
|
||||
})
|
||||
|
||||
@@ -52,13 +52,13 @@ test('import from package-lock.json', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('import from yarn.lock', async () => {
|
||||
@@ -72,13 +72,13 @@ test('import from yarn.lock', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('import from yarn2 lock file', async () => {
|
||||
@@ -90,14 +90,14 @@ test('import from yarn2 lock file', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/is-negative@1.0.0'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('balanced-match')
|
||||
await project.hasNot('brace-expansion')
|
||||
project.hasNot('balanced-match')
|
||||
project.hasNot('brace-expansion')
|
||||
})
|
||||
|
||||
test('import from npm-shrinkwrap.json', async () => {
|
||||
@@ -111,13 +111,13 @@ test('import from npm-shrinkwrap.json', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('import fails when no lockfiles are found', async () => {
|
||||
@@ -143,11 +143,11 @@ test('import from package-lock.json v3', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.0.0'])
|
||||
expect(lockfile.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/pkg-with-1-dep')
|
||||
})
|
||||
|
||||
@@ -55,13 +55,13 @@ test('import from shared yarn.lock of monorepo', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/is-negative@1.0.1'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('import from shared package-lock.json of monorepo', async () => {
|
||||
@@ -79,13 +79,13 @@ test('import from shared package-lock.json of monorepo', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/is-negative@1.0.1'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('import from shared npm-shrinkwrap.json of monorepo', async () => {
|
||||
@@ -103,11 +103,11 @@ test('import from shared npm-shrinkwrap.json of monorepo', async () => {
|
||||
}, [])
|
||||
|
||||
const project = assertProject(process.cwd())
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/is-positive@1.0.0'])
|
||||
expect(lockfile.packages).toHaveProperty(['/is-negative@1.0.1'])
|
||||
|
||||
// node_modules is not created
|
||||
await project.hasNot('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
project.hasNot('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
})
|
||||
|
||||
@@ -42,8 +42,8 @@ test('linking multiple packages', async () => {
|
||||
...linkOpts,
|
||||
}, ['linked-foo', '../linked-bar'])
|
||||
|
||||
await project.has('linked-foo')
|
||||
await project.has('linked-bar')
|
||||
project.has('linked-foo')
|
||||
project.has('linked-bar')
|
||||
|
||||
const modules = await readYamlFile<any>('../linked-bar/node_modules/.modules.yaml') // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
expect(modules.hoistPattern).toStrictEqual(['*']) // the linked package used its own configs during installation // eslint-disable-line @typescript-eslint/dot-notation
|
||||
@@ -74,7 +74,7 @@ test('link global bin', async function () {
|
||||
})
|
||||
process.env[PATH] = oldPath
|
||||
|
||||
await isExecutable((value) => {
|
||||
isExecutable((value) => {
|
||||
expect(value).toBeTruthy()
|
||||
}, path.join(globalBin, 'package-with-bin'))
|
||||
})
|
||||
@@ -103,7 +103,7 @@ test('link to global bin from the specified directory', async function () {
|
||||
})
|
||||
process.env[PATH] = oldPath
|
||||
|
||||
await isExecutable((value) => {
|
||||
isExecutable((value) => {
|
||||
expect(value).toBeTruthy()
|
||||
}, path.join(globalBin, 'package-with-bin-in-dir'))
|
||||
})
|
||||
@@ -152,7 +152,7 @@ test('link a global package to the specified directory', async function () {
|
||||
|
||||
const manifest = loadJsonFile<any>(path.join(projectDir, 'package.json')) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
expect(manifest.dependencies).toStrictEqual({ 'global-package-with-bin': '0.0.0' })
|
||||
await project.has('global-package-with-bin')
|
||||
project.has('global-package-with-bin')
|
||||
})
|
||||
|
||||
test('relative link', async () => {
|
||||
@@ -171,20 +171,20 @@ test('relative link', async () => {
|
||||
dir: process.cwd(),
|
||||
}, [`../${linkedPkgName}`])
|
||||
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
// The linked package has been installed successfully as well with bins linked
|
||||
// to node_modules/.bin
|
||||
const linkedProject = assertProject(linkedPkgPath)
|
||||
await linkedProject.isExecutable('.bin/cowsay')
|
||||
linkedProject.isExecutable('.bin/cowsay')
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.dependencies['@pnpm.e2e/hello-world-js-bin']).toStrictEqual({
|
||||
specifier: '*', // specifier of linked dependency added to ${WANTED_LOCKFILE}
|
||||
version: 'link:../hello-world-js-bin', // link added to wanted lockfile
|
||||
})
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.dependencies['@pnpm.e2e/hello-world-js-bin'].version).toBe('link:../hello-world-js-bin') // link added to wanted lockfile
|
||||
})
|
||||
|
||||
@@ -204,20 +204,20 @@ test('absolute link', async () => {
|
||||
dir: process.cwd(),
|
||||
}, [linkedPkgPath])
|
||||
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
project.isExecutable('.bin/hello-world-js-bin')
|
||||
|
||||
// The linked package has been installed successfully as well with bins linked
|
||||
// to node_modules/.bin
|
||||
const linkedProject = assertProject(linkedPkgPath)
|
||||
await linkedProject.isExecutable('.bin/cowsay')
|
||||
linkedProject.isExecutable('.bin/cowsay')
|
||||
|
||||
const wantedLockfile = await project.readLockfile()
|
||||
const wantedLockfile = project.readLockfile()
|
||||
expect(wantedLockfile.dependencies['@pnpm.e2e/hello-world-js-bin']).toStrictEqual({
|
||||
specifier: '*', // specifier of linked dependency added to ${WANTED_LOCKFILE}
|
||||
version: 'link:../hello-world-js-bin', // link added to wanted lockfile
|
||||
})
|
||||
|
||||
const currentLockfile = await project.readCurrentLockfile()
|
||||
const currentLockfile = project.readCurrentLockfile()
|
||||
expect(currentLockfile.dependencies['@pnpm.e2e/hello-world-js-bin'].version).toBe('link:../hello-world-js-bin') // link added to wanted lockfile
|
||||
})
|
||||
|
||||
@@ -259,12 +259,12 @@ test('link --production', async () => {
|
||||
dir: process.cwd(),
|
||||
}, ['../source'])
|
||||
|
||||
await projects['source'].has('is-positive')
|
||||
await projects['source'].hasNot('is-negative')
|
||||
projects['source'].has('is-positive')
|
||||
projects['source'].hasNot('is-negative')
|
||||
|
||||
// --production should not have effect on the target
|
||||
await projects['target'].has('is-positive')
|
||||
await projects['target'].has('is-negative')
|
||||
projects['target'].has('is-positive')
|
||||
projects['target'].has('is-negative')
|
||||
})
|
||||
|
||||
test('link fails if nothing is linked', async () => {
|
||||
@@ -356,4 +356,4 @@ test('logger should not warn about peer dependencies when it is an empty object'
|
||||
}))
|
||||
|
||||
warnMock.mockRestore()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -42,7 +42,7 @@ test('recursive linking/unlinking', async () => {
|
||||
expect(projects['project-1'].requireModule('is-positive/package.json').author).toBeFalsy()
|
||||
|
||||
{
|
||||
const project1Lockfile = await projects['project-1'].readLockfile()
|
||||
const project1Lockfile = projects['project-1'].readLockfile()
|
||||
expect(project1Lockfile.devDependencies['is-positive'].version).toBe('link:../is-positive')
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ test('recursive linking/unlinking', async () => {
|
||||
expect(await exists(path.resolve('node_modules', 'is-positive', 'index.js'))).toBeTruthy()
|
||||
|
||||
{
|
||||
const project1Lockfile = await projects['project-1'].readLockfile()
|
||||
const project1Lockfile = projects['project-1'].readLockfile()
|
||||
expect(project1Lockfile.lockfileVersion).toBe(LOCKFILE_VERSION)
|
||||
expect(project1Lockfile.devDependencies['is-positive'].version).toBe('1.0.0')
|
||||
expect(project1Lockfile.packages['/is-positive@1.0.0']).toBeTruthy()
|
||||
}
|
||||
|
||||
const isPositiveLockfile = await projects['is-positive'].readLockfile()
|
||||
const isPositiveLockfile = projects['is-positive'].readLockfile()
|
||||
expect(isPositiveLockfile.lockfileVersion).toBe(LOCKFILE_VERSION)
|
||||
})
|
||||
|
||||
@@ -107,7 +107,7 @@ test('recursive unlink specific package', async () => {
|
||||
expect(projects['project-1'].requireModule('is-positive/package.json').author).toBeFalsy()
|
||||
|
||||
{
|
||||
const project1Lockfile = await projects['project-1'].readLockfile()
|
||||
const project1Lockfile = projects['project-1'].readLockfile()
|
||||
expect(project1Lockfile.devDependencies['is-positive'].version).toBe('link:../is-positive')
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ test('recursive unlink specific package', async () => {
|
||||
expect(await exists(path.resolve('node_modules', 'is-positive', 'index.js'))).toBeTruthy()
|
||||
|
||||
{
|
||||
const project1Lockfile = await projects['project-1'].readLockfile()
|
||||
const project1Lockfile = projects['project-1'].readLockfile()
|
||||
expect(project1Lockfile.lockfileVersion).toBe(LOCKFILE_VERSION)
|
||||
expect(project1Lockfile.devDependencies['is-positive'].version).toBe('1.0.0')
|
||||
expect(project1Lockfile.packages['/is-positive@1.0.0']).toBeTruthy()
|
||||
}
|
||||
|
||||
const isPositiveLockfile = await projects['is-positive'].readLockfile()
|
||||
const isPositiveLockfile = projects['is-positive'].readLockfile()
|
||||
expect(isPositiveLockfile.lockfileVersion).toBe(LOCKFILE_VERSION)
|
||||
})
|
||||
|
||||
@@ -47,7 +47,7 @@ test('recursive add/remove', async () => {
|
||||
|
||||
expect(projects['project-1'].requireModule('is-positive')).toBeTruthy()
|
||||
expect(projects['project-2'].requireModule('is-negative')).toBeTruthy()
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
await add.handler({
|
||||
...DEFAULT_OPTS,
|
||||
@@ -72,7 +72,7 @@ test('recursive add/remove', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
}, ['is-negative'])
|
||||
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('recursive add/remove in workspace with many lockfiles', async () => {
|
||||
@@ -109,7 +109,7 @@ test('recursive add/remove in workspace with many lockfiles', async () => {
|
||||
|
||||
expect(projects['project-1'].requireModule('is-positive')).toBeTruthy()
|
||||
expect(projects['project-2'].requireModule('is-negative')).toBeTruthy()
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-2'].has('is-negative')
|
||||
|
||||
await add.handler({
|
||||
...DEFAULT_OPTS,
|
||||
@@ -134,7 +134,7 @@ test('recursive add/remove in workspace with many lockfiles', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
}, ['is-negative'])
|
||||
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
|
||||
{
|
||||
const manifest = await loadJsonFile<ProjectManifest>(path.resolve('project-1/package.json'))
|
||||
@@ -226,8 +226,8 @@ test('running `pnpm recursive` on a subset of packages', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('running `pnpm recursive` only for packages in subdirectories of cwd', async () => {
|
||||
@@ -278,9 +278,9 @@ test('running `pnpm recursive` only for packages in subdirectories of cwd', asyn
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
await projects['root-project'].hasNot('debug')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
projects['root-project'].hasNot('debug')
|
||||
})
|
||||
|
||||
test('recursive installation fails when installation in one of the packages fails', async () => {
|
||||
@@ -413,9 +413,9 @@ test('recursive --filter ignore excluded packages', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
await projects['project-3'].hasNot('minimatch')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
projects['project-3'].hasNot('minimatch')
|
||||
})
|
||||
|
||||
test('recursive filter multiple times', async () => {
|
||||
@@ -458,9 +458,9 @@ test('recursive filter multiple times', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
await projects['project-3'].hasNot('minimatch')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
projects['project-3'].hasNot('minimatch')
|
||||
})
|
||||
|
||||
test('recursive install --no-bail', async () => {
|
||||
@@ -540,7 +540,7 @@ test('installing with "workspace=true" should work even if link-workspace-packag
|
||||
expect(pkg.dependencies).toBeFalsy()
|
||||
}
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('installing with "workspace=true" should work even if link-workspace-packages is off and save-workspace-protocol is "rolling"', async () => {
|
||||
@@ -581,7 +581,7 @@ test('installing with "workspace=true" should work even if link-workspace-packag
|
||||
expect(pkg.dependencies).toBeFalsy()
|
||||
}
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-2')
|
||||
})
|
||||
|
||||
test('recursive install on workspace with custom lockfile-dir', async () => {
|
||||
@@ -654,8 +654,8 @@ test('recursive install in a monorepo with different modules directories', async
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive', 'modules_1')
|
||||
await projects['project-2'].has('is-positive', 'modules_2')
|
||||
projects['project-1'].has('is-positive', 'modules_1')
|
||||
projects['project-2'].has('is-positive', 'modules_2')
|
||||
})
|
||||
|
||||
test('recursive install in a monorepo with parsing env variables', async () => {
|
||||
@@ -685,7 +685,7 @@ test('recursive install in a monorepo with parsing env variables', async () => {
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
|
||||
await projects['project'].has('is-positive', `${process.env['SOME_NAME']}_modules`)
|
||||
projects['project'].has('is-positive', `${process.env['SOME_NAME']}_modules`)
|
||||
})
|
||||
|
||||
test('prefer-workspace-package', async () => {
|
||||
@@ -754,7 +754,7 @@ test('installing in monorepo with shared lockfile should work on virtual drives'
|
||||
workspaceDir: virtualPath,
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('is-positive')
|
||||
})
|
||||
|
||||
test('pass readPackage with shared lockfile', async () => {
|
||||
@@ -793,8 +793,8 @@ test('pass readPackage with shared lockfile', async () => {
|
||||
},
|
||||
})
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-1'].hasNot('is-negative')
|
||||
await projects['project-2'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-1'].hasNot('is-negative')
|
||||
projects['project-2'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
})
|
||||
|
||||
@@ -47,11 +47,11 @@ test('root dependency that has a peer is correctly updated after its version cha
|
||||
}, ['ajv@4.10.4', 'ajv-keywords@1.5.0'])
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['ajv-keywords'].version).toBe('1.5.0(ajv@4.10.4)')
|
||||
}
|
||||
|
||||
await project.writePackageJson({
|
||||
project.writePackageJson({
|
||||
dependencies: {
|
||||
ajv: '4.10.4',
|
||||
'ajv-keywords': '1.5.1',
|
||||
@@ -68,7 +68,7 @@ test('root dependency that has a peer is correctly updated after its version cha
|
||||
})
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['ajv-keywords'].version).toBe('1.5.1(ajv@4.10.4)')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ test('prune removes external link that is not in package.json', async () => {
|
||||
storeDir,
|
||||
}, ['./local'])
|
||||
|
||||
await project.has('local-pkg')
|
||||
project.has('local-pkg')
|
||||
|
||||
await prune.handler({
|
||||
...DEFAULT_OPTIONS,
|
||||
@@ -57,7 +57,7 @@ test('prune removes external link that is not in package.json', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.hasNot('local-pkg')
|
||||
project.hasNot('local-pkg')
|
||||
})
|
||||
|
||||
test('prune keeps hoisted dependencies', async () => {
|
||||
@@ -79,7 +79,7 @@ test('prune keeps hoisted dependencies', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
project.hasNot('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
})
|
||||
|
||||
test('prune removes dev dependencies', async () => {
|
||||
@@ -105,8 +105,8 @@ test('prune removes dev dependencies', async () => {
|
||||
storeDir,
|
||||
})
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('.pnpm/is-positive@1.0.0')
|
||||
await project.hasNot('is-negative')
|
||||
await project.hasNot('.pnpm/is-negative@1.0.0')
|
||||
project.has('is-positive')
|
||||
project.has('.pnpm/is-positive@1.0.0')
|
||||
project.hasNot('is-negative')
|
||||
project.hasNot('.pnpm/is-negative@1.0.0')
|
||||
})
|
||||
|
||||
@@ -129,7 +129,7 @@ test('interactively update', async () => {
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/micromatch@3.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/is-negative@1.0.1']).toBeTruthy()
|
||||
@@ -186,7 +186,7 @@ test('interactively update', async () => {
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/micromatch@3.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/is-negative@2.1.0']).toBeTruthy()
|
||||
@@ -347,7 +347,7 @@ test('interactively update should ignore dependencies from the ignoreDependencie
|
||||
)
|
||||
|
||||
{
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/micromatch@3.1.10']).toBeTruthy()
|
||||
expect(lockfile.packages['/is-negative@1.0.0']).toBeTruthy()
|
||||
|
||||
@@ -48,7 +48,7 @@ test('recursive update', async () => {
|
||||
}, ['is-positive@2.0.0'])
|
||||
|
||||
expect(projects['project-1'].requireModule('is-positive/package.json').version).toBe('2.0.0')
|
||||
await projects['project-2'].hasNot('is-positive')
|
||||
projects['project-2'].hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('recursive update prod dependencies only', async () => {
|
||||
@@ -372,13 +372,13 @@ test('recursive update --latest foo should only update packages that have foo',
|
||||
}, ['@pnpm.e2e/foo'])
|
||||
|
||||
{
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
|
||||
expect(Object.keys(lockfile.packages ?? {})).toStrictEqual(['/@pnpm.e2e/foo@100.1.0', '/@pnpm.e2e/qar@100.0.0'])
|
||||
}
|
||||
|
||||
{
|
||||
const lockfile = await projects['project-2'].readLockfile()
|
||||
const lockfile = projects['project-2'].readLockfile()
|
||||
|
||||
expect(Object.keys(lockfile.packages ?? {})).toStrictEqual(['/@pnpm.e2e/bar@100.0.0'])
|
||||
}
|
||||
@@ -412,6 +412,6 @@ test('recursive update in workspace should not add new dependencies', async () =
|
||||
expect(err).toBeTruthy()
|
||||
expect(err.code).toBe('ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES')
|
||||
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
await projects['project-2'].hasNot('is-positive')
|
||||
projects['project-1'].hasNot('is-positive')
|
||||
projects['project-2'].hasNot('is-positive')
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ test('update with "*" pattern', async () => {
|
||||
latest: true,
|
||||
}, ['@pnpm.e2e/peer-*'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-a@1.0.1']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-c@2.0.0']).toBeTruthy()
|
||||
@@ -62,7 +62,7 @@ test('update with negation pattern', async () => {
|
||||
latest: true,
|
||||
}, ['!@pnpm.e2e/peer-*'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-a@1.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-c@1.0.0']).toBeTruthy()
|
||||
@@ -172,7 +172,7 @@ test('update --no-save should not update package.json and pnpm-lock.yaml', async
|
||||
const manifest = await loadJsonFile<ProjectManifest>('package.json')
|
||||
expect(manifest.dependencies?.['@pnpm.e2e/peer-a']).toBe('^1.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/peer-a'].specifier).toBe('^1.0.0')
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-a@1.0.0']).toBeTruthy()
|
||||
}
|
||||
@@ -190,7 +190,7 @@ test('update --no-save should not update package.json and pnpm-lock.yaml', async
|
||||
const manifest = await loadJsonFile<ProjectManifest>('package.json')
|
||||
expect(manifest.dependencies?.['@pnpm.e2e/peer-a']).toBe('^1.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/peer-a'].specifier).toBe('^1.0.0')
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-a@1.0.1']).toBeTruthy()
|
||||
}
|
||||
@@ -223,7 +223,7 @@ test('update should work normal when set empty string version', async () => {
|
||||
latest: true,
|
||||
}, ['*'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-a@1.0.1']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/peer-c@2.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@2.0.0']).toBeTruthy()
|
||||
@@ -258,7 +258,7 @@ test('ignore packages in package.json > updateConfig.ignoreDependencies fields i
|
||||
dir: process.cwd(),
|
||||
})
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@100.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/bar@100.0.0']).toBeTruthy()
|
||||
@@ -274,7 +274,7 @@ test('ignore packages in package.json > updateConfig.ignoreDependencies fields i
|
||||
latest: true,
|
||||
})
|
||||
|
||||
const lockfileUpdated = await project.readLockfile()
|
||||
const lockfileUpdated = project.readLockfile()
|
||||
|
||||
expect(lockfileUpdated.packages['/@pnpm.e2e/foo@100.0.0']).toBeTruthy()
|
||||
expect(lockfileUpdated.packages['/@pnpm.e2e/bar@100.0.0']).toBeTruthy()
|
||||
@@ -304,7 +304,7 @@ test('not ignore packages if these are specified in parameter even if these are
|
||||
dir: process.cwd(),
|
||||
})
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
|
||||
expect(lockfile.packages['/@pnpm.e2e/foo@100.0.0']).toBeTruthy()
|
||||
expect(lockfile.packages['/@pnpm.e2e/bar@100.0.0']).toBeTruthy()
|
||||
@@ -317,7 +317,7 @@ test('not ignore packages if these are specified in parameter even if these are
|
||||
dir: process.cwd(),
|
||||
}, ['@pnpm.e2e/foo@latest', '@pnpm.e2e/bar@latest'])
|
||||
|
||||
const lockfileUpdated = await project.readLockfile()
|
||||
const lockfileUpdated = project.readLockfile()
|
||||
|
||||
expect(lockfileUpdated.packages['/@pnpm.e2e/foo@100.1.0']).toBeTruthy()
|
||||
expect(lockfileUpdated.packages['/@pnpm.e2e/bar@100.1.0']).toBeTruthy()
|
||||
@@ -350,7 +350,7 @@ test('do not update anything if all the dependencies are ignored and trying to u
|
||||
latest: true,
|
||||
}, [])
|
||||
|
||||
const lockfileUpdated = await project.readLockfile()
|
||||
const lockfileUpdated = project.readLockfile()
|
||||
expect(lockfileUpdated.packages['/@pnpm.e2e/foo@100.0.0']).toBeTruthy()
|
||||
})
|
||||
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -199,9 +199,6 @@ importers:
|
||||
isexe:
|
||||
specifier: 2.0.0
|
||||
version: 2.0.0
|
||||
path-exists:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0
|
||||
read-yaml-file:
|
||||
specifier: ^2.1.0
|
||||
version: 2.1.0
|
||||
|
||||
@@ -31,7 +31,7 @@ test('installs in the folder where the package.json file is', async () => {
|
||||
|
||||
const m = project.requireModule('rimraf')
|
||||
expect(typeof m).toBe('function')
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
})
|
||||
|
||||
test('pnpm import does not move modules created by npm', async () => {
|
||||
@@ -111,7 +111,7 @@ test('adding new dep does not fail if node_modules was created with --public-hoi
|
||||
expect(execPnpmSync(['add', 'is-negative', '--no-shamefully-hoist']).status).toBe(1)
|
||||
expect(execPnpmSync(['add', 'is-negative']).status).toBe(0)
|
||||
|
||||
await project.has('is-negative')
|
||||
project.has('is-negative')
|
||||
})
|
||||
|
||||
test('pnpx works', () => {
|
||||
|
||||
@@ -36,7 +36,7 @@ test('readPackage hook in single project doesn\'t modify manifest', async () =>
|
||||
await execPnpm(['remove', 'is-positive'])
|
||||
pkg = await loadJsonFile(path.resolve('package.json'))
|
||||
expect(pkg.dependencies).toBeFalsy() // remove & readPackage hook work
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
// Reset for --lockfile-only checks
|
||||
await fs.unlink('pnpm-lock.yaml')
|
||||
@@ -180,7 +180,7 @@ test('should use default fetchers if no custom fetchers are defined', async () =
|
||||
|
||||
await execPnpm(['add', 'is-positive@1.0.0'])
|
||||
|
||||
await project.cafsHas('is-positive', '1.0.0')
|
||||
project.cafsHas('is-positive', '1.0.0')
|
||||
})
|
||||
|
||||
test('custom fetcher can call default fetcher', async () => {
|
||||
@@ -212,7 +212,7 @@ test('custom fetcher can call default fetcher', async () => {
|
||||
|
||||
await execPnpm(['add', 'is-positive@1.0.0'])
|
||||
|
||||
await project.cafsHas('is-positive', '1.0.0')
|
||||
project.cafsHas('is-positive', '1.0.0')
|
||||
|
||||
const args = await loadJsonFile<any>('args.json') // eslint-disable-line
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ test('hoist the dependency graph', async () => {
|
||||
|
||||
await execPnpm(['install', 'express@4.16.2'])
|
||||
|
||||
await project.has('express')
|
||||
await project.has('.pnpm/node_modules/debug')
|
||||
await project.has('.pnpm/node_modules/cookie')
|
||||
project.has('express')
|
||||
project.has('.pnpm/node_modules/debug')
|
||||
project.has('.pnpm/node_modules/cookie')
|
||||
|
||||
await execPnpm(['uninstall', 'express'])
|
||||
|
||||
await project.hasNot('express')
|
||||
await project.hasNot('.pnpm/node_modules/debug')
|
||||
await project.hasNot('.pnpm/node_modules/cookie')
|
||||
project.hasNot('express')
|
||||
project.hasNot('.pnpm/node_modules/debug')
|
||||
project.hasNot('.pnpm/node_modules/cookie')
|
||||
})
|
||||
|
||||
test('shamefully hoist the dependency graph', async () => {
|
||||
@@ -24,15 +24,15 @@ test('shamefully hoist the dependency graph', async () => {
|
||||
|
||||
await execPnpm(['add', '--shamefully-hoist', 'express@4.16.2'])
|
||||
|
||||
await project.has('express')
|
||||
await project.has('debug')
|
||||
await project.has('cookie')
|
||||
project.has('express')
|
||||
project.has('debug')
|
||||
project.has('cookie')
|
||||
|
||||
await execPnpm(['remove', 'express'])
|
||||
|
||||
await project.hasNot('express')
|
||||
await project.hasNot('debug')
|
||||
await project.hasNot('cookie')
|
||||
project.hasNot('express')
|
||||
project.hasNot('debug')
|
||||
project.hasNot('cookie')
|
||||
})
|
||||
|
||||
test('shamefully-hoist: applied to all the workspace projects when set to true in the root .npmrc file', async () => {
|
||||
@@ -62,11 +62,11 @@ test('shamefully-hoist: applied to all the workspace projects when set to true i
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
await projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects.root.has('@pnpm.e2e/foo')
|
||||
await projects.root.has('@pnpm.e2e/foobar')
|
||||
await projects.project.hasNot('@pnpm.e2e/foo')
|
||||
await projects.project.has('@pnpm.e2e/foobar')
|
||||
projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects.root.has('@pnpm.e2e/foo')
|
||||
projects.root.has('@pnpm.e2e/foobar')
|
||||
projects.project.hasNot('@pnpm.e2e/foo')
|
||||
projects.project.has('@pnpm.e2e/foobar')
|
||||
})
|
||||
|
||||
test('shamefully-hoist: applied to all the workspace projects when set to true in the root .npmrc file (with dedupe-direct-deps=true)', async () => {
|
||||
@@ -97,9 +97,9 @@ dedupe-direct-deps=true`, 'utf8')
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
await projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects.root.has('@pnpm.e2e/foo')
|
||||
await projects.root.has('@pnpm.e2e/foobar')
|
||||
await projects.project.hasNot('@pnpm.e2e/foo')
|
||||
await projects.project.hasNot('@pnpm.e2e/foobar')
|
||||
projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects.root.has('@pnpm.e2e/foo')
|
||||
projects.root.has('@pnpm.e2e/foobar')
|
||||
projects.project.hasNot('@pnpm.e2e/foo')
|
||||
projects.project.hasNot('@pnpm.e2e/foobar')
|
||||
})
|
||||
|
||||
@@ -34,7 +34,7 @@ test('readPackage hook', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('readPackage async hook', async () => {
|
||||
@@ -59,7 +59,7 @@ test('readPackage async hook', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('readPackage hook makes installation fail if it does not return the modified package manifests', async () => {
|
||||
@@ -101,7 +101,7 @@ test('readPackage hook from custom location', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep', '--pnpmfile', 'pnpm.js'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('readPackage hook from global pnpmfile', async () => {
|
||||
@@ -126,7 +126,7 @@ test('readPackage hook from global pnpmfile', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep', '--global-pnpmfile', path.resolve('..', '.pnpmfile.cjs')])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('readPackage hook from global pnpmfile and local pnpmfile', async () => {
|
||||
@@ -166,8 +166,8 @@ test('readPackage hook from global pnpmfile and local pnpmfile', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep', '--global-pnpmfile', path.resolve('..', '.pnpmfile.cjs')])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
await project.storeHas('is-positive', '1.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('is-positive', '1.0.0')
|
||||
})
|
||||
|
||||
test('readPackage async hook from global pnpmfile and local pnpmfile', async () => {
|
||||
@@ -207,8 +207,8 @@ test('readPackage async hook from global pnpmfile and local pnpmfile', async ()
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep', '--global-pnpmfile', path.resolve('..', '.pnpmfile.cjs')])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
await project.storeHas('is-positive', '1.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('is-positive', '1.0.0')
|
||||
})
|
||||
|
||||
test('readPackage hook from pnpmfile at root of workspace', async () => {
|
||||
@@ -243,8 +243,8 @@ test('readPackage hook from pnpmfile at root of workspace', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-negative@1.0.0', '--store-dir', storeDir])
|
||||
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
|
||||
process.chdir('..')
|
||||
|
||||
@@ -283,7 +283,7 @@ test('readPackage hook during update', async () => {
|
||||
|
||||
await execPnpm(['update'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
})
|
||||
|
||||
test('prints meaningful error when there is syntax error in .pnpmfile.cjs', async () => {
|
||||
@@ -329,7 +329,7 @@ test('ignore .pnpmfile.cjs when --ignore-pnpmfile is used', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/pkg-with-1-dep', '--ignore-pnpmfile'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
})
|
||||
|
||||
test('ignore .pnpmfile.cjs during update when --ignore-pnpmfile is used', async () => {
|
||||
@@ -357,7 +357,7 @@ test('ignore .pnpmfile.cjs during update when --ignore-pnpmfile is used', async
|
||||
|
||||
await execPnpm(['update', '--ignore-pnpmfile'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
})
|
||||
|
||||
test('pnpmfile: pass log function to readPackage hook', async () => {
|
||||
@@ -383,7 +383,7 @@ test('pnpmfile: pass log function to readPackage hook', async () => {
|
||||
|
||||
const proc = execPnpmSync(['install', '@pnpm.e2e/pkg-with-1-dep', '--reporter', 'ndjson'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
const outputs = proc.stdout.toString().split(/\r?\n/)
|
||||
|
||||
@@ -437,8 +437,8 @@ test('pnpmfile: pass log function to readPackage hook of global and local pnpmfi
|
||||
|
||||
const proc = execPnpmSync(['install', '@pnpm.e2e/pkg-with-1-dep', '--global-pnpmfile', path.resolve('..', '.pnpmfile.cjs'), '--reporter', 'ndjson'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
await project.storeHas('is-positive', '1.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('is-positive', '1.0.0')
|
||||
|
||||
const outputs = proc.stdout.toString().split(/\r?\n/)
|
||||
|
||||
@@ -568,7 +568,7 @@ test('readPackage hook overrides project package', async () => {
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const pkg = await import(path.resolve('package.json'))
|
||||
expect(pkg.dependencies).toBeFalsy()
|
||||
|
||||
@@ -108,8 +108,8 @@ test('dependency should not be added to package.json and lockfile if it was not
|
||||
|
||||
expect(result.status).toBe(1)
|
||||
|
||||
expect(await project.readCurrentLockfile()).toBeFalsy()
|
||||
expect(await project.readLockfile()).toBeFalsy()
|
||||
expect(project.readCurrentLockfile()).toBeFalsy()
|
||||
expect(project.readLockfile()).toBeFalsy()
|
||||
|
||||
const { default: pkg } = await import(path.resolve('package.json'))
|
||||
expect(pkg).toStrictEqual({ name: 'foo', version: '1.0.0' })
|
||||
|
||||
@@ -41,9 +41,9 @@ skipOnWindows('install --lockfile-only', async () => {
|
||||
|
||||
await execPnpm(['install', 'rimraf@2.5.1', '--lockfile-only'])
|
||||
|
||||
await project.hasNot('rimraf')
|
||||
project.hasNot('rimraf')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/rimraf@2.5.1'])
|
||||
})
|
||||
|
||||
@@ -52,9 +52,9 @@ test('install --no-lockfile', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-positive', '--no-lockfile'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
expect(await project.readLockfile()).toBeFalsy()
|
||||
expect(project.readLockfile()).toBeFalsy()
|
||||
})
|
||||
|
||||
test('write to stderr when --use-stderr is used', async () => {
|
||||
@@ -62,7 +62,7 @@ test('write to stderr when --use-stderr is used', async () => {
|
||||
|
||||
const result = execPnpmSync(['add', 'is-positive', '--use-stderr'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
expect(result.stdout.toString()).toBe('')
|
||||
expect(result.stderr.toString()).not.toBe('')
|
||||
})
|
||||
@@ -74,9 +74,9 @@ test('install with package-lock=false in .npmrc', async () => {
|
||||
|
||||
await execPnpm(['add', 'is-positive'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
expect(await project.readLockfile()).toBeFalsy()
|
||||
expect(project.readLockfile()).toBeFalsy()
|
||||
})
|
||||
|
||||
test('install from any location via the --prefix flag', async () => {
|
||||
@@ -90,8 +90,8 @@ test('install from any location via the --prefix flag', async () => {
|
||||
|
||||
await execPnpm(['install', '--prefix', 'project'])
|
||||
|
||||
await project.has('rimraf')
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
project.has('rimraf')
|
||||
project.isExecutable('.bin/rimraf')
|
||||
})
|
||||
|
||||
test('install with external lockfile directory', async () => {
|
||||
@@ -99,7 +99,7 @@ test('install with external lockfile directory', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-positive', '--lockfile-directory', path.resolve('..')])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const lockfile = await readYamlFile<Lockfile>(path.resolve('..', WANTED_LOCKFILE))
|
||||
|
||||
@@ -111,7 +111,7 @@ test('install --save-exact', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-positive@3.1.0', '--save-exact', '--save-dev'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const pkg = await readPackageJsonFromDir(process.cwd())
|
||||
|
||||
@@ -125,7 +125,7 @@ test('install to a project that uses package.yaml', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-positive@3.1.0', '--save-exact', '--save-dev'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const { manifest } = await readProjectManifest(process.cwd())
|
||||
|
||||
@@ -137,7 +137,7 @@ test('install save new dep with the specified spec', async () => {
|
||||
|
||||
await execPnpm(['install', 'is-positive@~3.1.0'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
|
||||
const pkg = await readPackageJsonFromDir(process.cwd())
|
||||
|
||||
@@ -150,14 +150,14 @@ test("don't fail on case insensitive filesystems when package has 2 files with s
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/with-same-file-in-different-cases'])
|
||||
|
||||
await project.has('@pnpm.e2e/with-same-file-in-different-cases')
|
||||
project.has('@pnpm.e2e/with-same-file-in-different-cases')
|
||||
|
||||
const { files: integrityFile } = await loadJsonFile<{ files: object }>(await project.getPkgIndexFilePath('@pnpm.e2e/with-same-file-in-different-cases', '1.0.0'))
|
||||
const { files: integrityFile } = await loadJsonFile<{ files: object }>(project.getPkgIndexFilePath('@pnpm.e2e/with-same-file-in-different-cases', '1.0.0'))
|
||||
const packageFiles = Object.keys(integrityFile).sort()
|
||||
|
||||
expect(packageFiles).toStrictEqual(['Foo.js', 'foo.js', 'package.json'])
|
||||
const files = await fs.readdir('node_modules/@pnpm.e2e/with-same-file-in-different-cases')
|
||||
const storeDir = await project.getStorePath()
|
||||
const storeDir = project.getStorePath()
|
||||
if (await dirIsCaseSensitive(storeDir)) {
|
||||
expect([...files]).toStrictEqual(['Foo.js', 'foo.js', 'package.json'])
|
||||
} else {
|
||||
@@ -457,7 +457,7 @@ test('installing in a CI environment', async () => {
|
||||
|
||||
await execPnpm(['install'], { env: { CI: 'true' } })
|
||||
|
||||
await project.writePackageJson({
|
||||
project.writePackageJson({
|
||||
dependencies: { rimraf: '1' },
|
||||
})
|
||||
|
||||
@@ -472,7 +472,7 @@ test('installing in a CI environment', async () => {
|
||||
await execPnpm(['install', '--no-frozen-lockfile'], { env: { CI: 'true' } })
|
||||
|
||||
await rimraf('node_modules')
|
||||
await project.writePackageJson({
|
||||
project.writePackageJson({
|
||||
dependencies: { rimraf: '2' },
|
||||
})
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ test('production install (with --production flag)', async () => {
|
||||
|
||||
await execPnpm(['install', '--production'])
|
||||
|
||||
await project.hasNot(Object.keys(basicPackageManifest.devDependencies!)[0])
|
||||
await project.has('rimraf')
|
||||
await project.has('is-positive')
|
||||
project.hasNot(Object.keys(basicPackageManifest.devDependencies!)[0])
|
||||
project.has('rimraf')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test('production install (with production NODE_ENV)', async () => {
|
||||
@@ -21,9 +21,9 @@ test('production install (with production NODE_ENV)', async () => {
|
||||
|
||||
await execPnpm(['install'], { env: { NODE_ENV: 'production' } })
|
||||
|
||||
await project.hasNot(Object.keys(basicPackageManifest.devDependencies!)[0])
|
||||
await project.has('rimraf')
|
||||
await project.has('is-positive')
|
||||
project.hasNot(Object.keys(basicPackageManifest.devDependencies!)[0])
|
||||
project.has('rimraf')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test('dev dependencies install (with production NODE_ENV)', async () => {
|
||||
@@ -31,8 +31,8 @@ test('dev dependencies install (with production NODE_ENV)', async () => {
|
||||
|
||||
await execPnpm(['install', '--dev'], { env: { NODE_ENV: 'production' } })
|
||||
|
||||
await project.hasNot(Object.keys(basicPackageManifest.dependencies!)[0])
|
||||
await project.has('@rstacruz/tap-spec')
|
||||
project.hasNot(Object.keys(basicPackageManifest.dependencies!)[0])
|
||||
project.has('@rstacruz/tap-spec')
|
||||
})
|
||||
|
||||
test('install dev dependencies only', async () => {
|
||||
@@ -57,5 +57,5 @@ test('install dev dependencies only', async () => {
|
||||
const isNegative = project.requireModule('is-negative')
|
||||
expect(typeof isNegative).toBe('function')
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
})
|
||||
|
||||
@@ -14,8 +14,8 @@ test('installing optional dependencies when --no-optional is not used', async ()
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
project.has('is-positive')
|
||||
project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
|
||||
expect(deepRequireCwd(['@pnpm.e2e/pkg-with-good-optional', '@pnpm.e2e/dep-of-pkg-with-1-dep', './package.json'])).toBeTruthy()
|
||||
expect(deepRequireCwd(['@pnpm.e2e/pkg-with-good-optional', 'is-positive', './package.json'])).toBeTruthy()
|
||||
@@ -33,8 +33,8 @@ test('not installing optional dependencies when --no-optional is used', async ()
|
||||
|
||||
await execPnpm(['install', '--no-optional'])
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
await project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
project.hasNot('is-positive')
|
||||
project.has('@pnpm.e2e/pkg-with-good-optional')
|
||||
|
||||
expect(deepRequireCwd(['@pnpm.e2e/pkg-with-good-optional', '@pnpm.e2e/dep-of-pkg-with-1-dep', './package.json'])).toBeTruthy()
|
||||
expect(deepRequireCwd.silent(['@pnpm.e2e/pkg-with-good-optional', 'is-positive', './package.json'])).toBeFalsy()
|
||||
|
||||
@@ -32,5 +32,5 @@ skipOnWindows('self-update stops the store server', async () => {
|
||||
await execPnpm(['install', '-g', 'pnpm', '--store-dir', path.resolve('..', 'store'), '--reporter=append-only'], { env })
|
||||
|
||||
expect(await pathExists(serverJsonPath)).toBeFalsy()
|
||||
await project.isExecutable('../pnpm')
|
||||
project.isExecutable('../pnpm')
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@ test.skip('caching side effects of native package', async function () {
|
||||
const project = prepare()
|
||||
|
||||
await execPnpm(['add', '--side-effects-cache', 'diskusage@1.1.3'])
|
||||
const storePath = await project.getStorePath()
|
||||
const storePath = project.getStorePath()
|
||||
const cacheBuildDir = path.join(storePath, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
const stat1 = await fs.stat(cacheBuildDir)
|
||||
|
||||
@@ -33,7 +33,7 @@ test.skip('using side effects cache', async function () {
|
||||
// Right now, hardlink does not work with side effects, so we specify copy as the packageImportMethod
|
||||
// We disable verifyStoreIntegrity because we are going to change the cache
|
||||
await execPnpm(['add', 'diskusage@1.1.3', '--side-effects-cache', '--no-verify-store-integrity', '--package-import-method', 'copy'])
|
||||
const storePath = await project.getStorePath()
|
||||
const storePath = project.getStorePath()
|
||||
|
||||
const cacheBuildDir = path.join(storePath, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
await fs.writeFile(path.join(cacheBuildDir, 'new-file.txt'), 'some new content')
|
||||
@@ -48,7 +48,7 @@ test.skip('readonly side effects cache', async function () {
|
||||
const project = prepare()
|
||||
|
||||
await execPnpm(['add', 'diskusage@1.1.2', '--side-effects-cache', '--no-verify-store-integrity'])
|
||||
const storePath = await project.getStorePath()
|
||||
const storePath = project.getStorePath()
|
||||
|
||||
// Modify the side effects cache to make sure we are using it
|
||||
const cacheBuildDir = path.join(storePath, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.2/side_effects/${ENGINE_DIR}/package/build`)
|
||||
|
||||
@@ -27,5 +27,5 @@ console.log("hello world");`, 'utf8')
|
||||
const ok = (value: any) => { // eslint-disable-line
|
||||
expect(value).toBeTruthy()
|
||||
}
|
||||
await isExecutable(ok, path.join(pnpmHome, 'cmd'))
|
||||
isExecutable(ok, path.join(pnpmHome, 'cmd'))
|
||||
})
|
||||
|
||||
@@ -113,9 +113,9 @@ test('linking a package inside a monorepo', async () => {
|
||||
expect(pkg?.devDependencies).toStrictEqual({ 'project-3': '^3.0.0' }) // spec of linked package added to devDependencies
|
||||
expect(pkg?.optionalDependencies).toStrictEqual({ 'project-4': '^4.0.0' }) // spec of linked package added to optionalDependencies
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('project-3')
|
||||
await projects['project-1'].has('project-4')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-3')
|
||||
projects['project-1'].has('project-4')
|
||||
})
|
||||
|
||||
test('linking a package inside a monorepo with --link-workspace-packages when installing new dependencies', async () => {
|
||||
@@ -155,9 +155,9 @@ test('linking a package inside a monorepo with --link-workspace-packages when in
|
||||
expect(pkg?.devDependencies).toStrictEqual({ 'project-3': 'workspace:^' }) // spec of linked package added to devDependencies
|
||||
expect(pkg?.optionalDependencies).toStrictEqual({ 'project-4': '^4.0.0' }) // spec of linked package added to optionalDependencies
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('project-3')
|
||||
await projects['project-1'].has('project-4')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-3')
|
||||
projects['project-1'].has('project-4')
|
||||
})
|
||||
|
||||
test('linking a package inside a monorepo with --link-workspace-packages when installing new dependencies and save-workspace-protocol is "rolling"', async () => {
|
||||
@@ -203,9 +203,9 @@ test('linking a package inside a monorepo with --link-workspace-packages when in
|
||||
expect(pkg?.devDependencies).toStrictEqual({ 'project-3': 'workspace:^' }) // spec of linked package added to devDependencies
|
||||
expect(pkg?.optionalDependencies).toStrictEqual({ 'project-4': '^4.0.0' }) // spec of linked package added to optionalDependencies
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('project-3')
|
||||
await projects['project-1'].has('project-4')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('project-3')
|
||||
projects['project-1'].has('project-4')
|
||||
})
|
||||
|
||||
test('linking a package inside a monorepo with --link-workspace-packages', async () => {
|
||||
@@ -260,18 +260,18 @@ save-workspace-protocol=false
|
||||
|
||||
expect(server.getLines()).toStrictEqual(['project-2', 'project-1'])
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('is-negative')
|
||||
await projects['project-1'].has('is-positive')
|
||||
projects['project-1'].has('project-2')
|
||||
projects['project-1'].has('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
|
||||
{
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
expect(lockfile.dependencies['project-2'].version).toBe('link:../project-2')
|
||||
expect(lockfile.devDependencies['is-negative'].version).toBe('link:../is-negative')
|
||||
expect(lockfile.optionalDependencies['is-positive'].version).toBe('link:../is-positive')
|
||||
}
|
||||
|
||||
await projects['is-positive'].writePackageJson({
|
||||
projects['is-positive'].writePackageJson({
|
||||
name: 'is-positive',
|
||||
version: '2.0.0',
|
||||
})
|
||||
@@ -279,14 +279,14 @@ save-workspace-protocol=false
|
||||
await execPnpm(['install'])
|
||||
|
||||
{
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
expect(lockfile.optionalDependencies['is-positive'].version).toBe('1.0.0') // is-positive is unlinked and installed from registry
|
||||
}
|
||||
|
||||
await execPnpm(['update', 'is-negative@2.0.0'])
|
||||
|
||||
{
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
expect(lockfile.devDependencies['is-negative'].version).toBe('2.0.0')
|
||||
}
|
||||
})
|
||||
@@ -594,7 +594,7 @@ test('installation with --link-workspace-packages links packages even if they we
|
||||
await execPnpm(['recursive', 'install', '--no-link-workspace-packages'])
|
||||
|
||||
{
|
||||
const lockfile = await projects.project.readLockfile()
|
||||
const lockfile = projects.project.readLockfile()
|
||||
expect(lockfile.dependencies['is-positive'].version).toBe('2.0.0')
|
||||
expect(lockfile.dependencies.negative.version).toBe('/is-negative@1.0.0')
|
||||
}
|
||||
@@ -602,7 +602,7 @@ test('installation with --link-workspace-packages links packages even if they we
|
||||
await execPnpm(['recursive', 'install', '--link-workspace-packages'])
|
||||
|
||||
{
|
||||
const lockfile = await projects.project.readLockfile()
|
||||
const lockfile = projects.project.readLockfile()
|
||||
expect(lockfile.dependencies['is-positive'].version).toBe('link:../is-positive')
|
||||
expect(lockfile.dependencies.negative.version).toBe('link:../is-negative')
|
||||
}
|
||||
@@ -640,12 +640,12 @@ test('shared-workspace-lockfile: installation with --link-workspace-packages lin
|
||||
expect(lockfile.importers!.project!.dependencies!.negative.version).toBe('/is-negative@1.0.0')
|
||||
}
|
||||
|
||||
await projects['is-positive'].writePackageJson({
|
||||
projects['is-positive'].writePackageJson({
|
||||
name: 'is-positive',
|
||||
version: '2.0.0',
|
||||
})
|
||||
|
||||
await projects['is-negative'].writePackageJson({
|
||||
projects['is-negative'].writePackageJson({
|
||||
name: 'is-negative',
|
||||
version: '1.0.0',
|
||||
})
|
||||
@@ -865,7 +865,7 @@ test('recursive installation with shared-workspace-lockfile and a readPackage ho
|
||||
|
||||
await execPnpm(['recursive', 'install', '--shared-workspace-lockfile', '--store-dir', 'store', '--filter', 'project-1'])
|
||||
|
||||
await projects['project-1'].hasNot('project-1')
|
||||
projects['project-1'].hasNot('project-1')
|
||||
})
|
||||
|
||||
test('local packages should be preferred when running "pnpm install" inside a workspace', async () => {
|
||||
@@ -891,7 +891,7 @@ test('local packages should be preferred when running "pnpm install" inside a wo
|
||||
|
||||
await execPnpm(['link', '.'])
|
||||
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
|
||||
expect(lockfile?.dependencies?.['is-positive'].version).toBe('link:../is-positive')
|
||||
})
|
||||
@@ -1149,7 +1149,7 @@ test('shared-workspace-lockfile config is ignored if no pnpm-workspace.yaml is f
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
})
|
||||
|
||||
test('shared-workspace-lockfile: removing a package recursively', async () => {
|
||||
@@ -1317,14 +1317,14 @@ test("linking the package's bin to another workspace package in a monorepo", asy
|
||||
|
||||
await execPnpm(['recursive', 'install'])
|
||||
|
||||
await projects.main.isExecutable('.bin/hello')
|
||||
projects.main.isExecutable('.bin/hello')
|
||||
|
||||
expect(await exists('main/node_modules')).toBeTruthy()
|
||||
await rimraf('main/node_modules')
|
||||
|
||||
await execPnpm(['recursive', 'install', '--frozen-lockfile'])
|
||||
|
||||
await projects.main.isExecutable('.bin/hello')
|
||||
projects.main.isExecutable('.bin/hello')
|
||||
})
|
||||
|
||||
test('pnpm sees the bins from the root of the workspace', async () => {
|
||||
@@ -1458,8 +1458,13 @@ test('custom virtual store directory in a workspace with not shared lockfile', a
|
||||
await execPnpm(['install'])
|
||||
|
||||
{
|
||||
const modulesManifest = await projects['project-1'].readModulesManifest()
|
||||
expect(modulesManifest?.virtualStoreDir).toBe(path.resolve('project-1/virtual-store'))
|
||||
const modulesManifest = projects['project-1'].readModulesManifest()
|
||||
const virtualStoreDir = modulesManifest!.virtualStoreDir
|
||||
if (path.isAbsolute(virtualStoreDir)) {
|
||||
expect(virtualStoreDir).toBe(path.resolve('project-1/virtual-store'))
|
||||
} else {
|
||||
expect(virtualStoreDir).toBe('../virtual-store')
|
||||
}
|
||||
}
|
||||
|
||||
await rimraf('project-1/virtual-store')
|
||||
@@ -1468,8 +1473,13 @@ test('custom virtual store directory in a workspace with not shared lockfile', a
|
||||
await execPnpm(['install', '--frozen-lockfile'])
|
||||
|
||||
{
|
||||
const modulesManifest = await projects['project-1'].readModulesManifest()
|
||||
expect(modulesManifest?.virtualStoreDir).toBe(path.resolve('project-1/virtual-store'))
|
||||
const modulesManifest = projects['project-1'].readModulesManifest()
|
||||
const virtualStoreDir = modulesManifest!.virtualStoreDir
|
||||
if (path.isAbsolute(virtualStoreDir)) {
|
||||
expect(virtualStoreDir).toBe(path.resolve('project-1/virtual-store'))
|
||||
} else {
|
||||
expect(virtualStoreDir).toBe('../virtual-store')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1837,7 +1847,7 @@ test('peer dependencies are resolved from the root of the workspace when a new d
|
||||
|
||||
await execPnpm(['add', 'ajv-keywords@1.5.0', '--strict-peer-dependencies', '--config.resolve-peers-from-workspace-root=true'])
|
||||
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/ajv-keywords@1.5.0(ajv@4.10.4)'])
|
||||
})
|
||||
|
||||
@@ -1866,7 +1876,7 @@ shared-workspace-lockfile=false
|
||||
|
||||
await execPnpm(['install'])
|
||||
|
||||
const lockfile = await projects['project-1'].readLockfile()
|
||||
const lockfile = projects['project-1'].readLockfile()
|
||||
expect(lockfile.overrides).toStrictEqual({
|
||||
'is-odd': '1.0.0',
|
||||
})
|
||||
|
||||
@@ -175,10 +175,10 @@ test('recursive installation of packages with hooks', async () => {
|
||||
|
||||
await execPnpm(['recursive', 'install'])
|
||||
|
||||
const lockfile1 = await projects['project-1'].readLockfile()
|
||||
const lockfile1 = projects['project-1'].readLockfile()
|
||||
expect(lockfile1.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
const lockfile2 = await projects['project-2'].readLockfile()
|
||||
const lockfile2 = projects['project-2'].readLockfile()
|
||||
expect(lockfile2.packages).toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
|
||||
@@ -273,10 +273,10 @@ test('ignores .pnpmfile.cjs during recursive installation when --ignore-pnpmfile
|
||||
|
||||
await execPnpm(['recursive', 'install', '--ignore-pnpmfile'])
|
||||
|
||||
const lockfile1 = await projects['project-1'].readLockfile()
|
||||
const lockfile1 = projects['project-1'].readLockfile()
|
||||
expect(lockfile1.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
|
||||
const lockfile2 = await projects['project-2'].readLockfile()
|
||||
const lockfile2 = projects['project-2'].readLockfile()
|
||||
expect(lockfile2.packages).not.toHaveProperty(['/@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'])
|
||||
})
|
||||
|
||||
@@ -313,9 +313,9 @@ test('recursive command with filter from config', async () => {
|
||||
await fs.writeFile('.npmrc', 'filter=project-1 project-2', 'utf8')
|
||||
await execPnpm(['recursive', 'install'])
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
await projects['project-3'].hasNot('minimatch')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].has('is-negative')
|
||||
projects['project-3'].hasNot('minimatch')
|
||||
})
|
||||
|
||||
test('non-recursive install ignores filter from config', async () => {
|
||||
@@ -352,9 +352,9 @@ test('non-recursive install ignores filter from config', async () => {
|
||||
await fs.writeFile('.npmrc', 'filter=project-2', 'utf8')
|
||||
await execPnpm(['install'])
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
await projects['project-3'].hasNot('minimatch')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
projects['project-3'].hasNot('minimatch')
|
||||
})
|
||||
|
||||
test('adding new dependency in the root should fail if neither --workspace-root nor --ignore-workspace-root-check are used', async () => {
|
||||
@@ -374,21 +374,21 @@ test('adding new dependency in the root should fail if neither --workspace-root
|
||||
const { status } = execPnpmSync(['add', 'is-positive', '--ignore-workspace-root-check'])
|
||||
|
||||
expect(status).toBe(0)
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
}
|
||||
|
||||
{
|
||||
const { status } = execPnpmSync(['add', 'is-odd', '--workspace-root'])
|
||||
|
||||
expect(status).toBe(0)
|
||||
await project.has('is-odd')
|
||||
project.has('is-odd')
|
||||
}
|
||||
|
||||
{
|
||||
const { status } = execPnpmSync(['add', 'is-even', '-w'])
|
||||
|
||||
expect(status).toBe(0)
|
||||
await project.has('is-even')
|
||||
project.has('is-even')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -423,8 +423,8 @@ test('--workspace-packages', async () => {
|
||||
|
||||
await execPnpm(['install', '--store-dir', storeDir, '--workspace-packages', 'project-1'])
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-positive')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-positive')
|
||||
})
|
||||
|
||||
test('set recursive-install to false in .npmrc would disable recursive install in workspace', async () => {
|
||||
@@ -461,8 +461,8 @@ dedupe-peer-dependents = false`, 'utf8')
|
||||
process.chdir('project-1')
|
||||
await execPnpm(['install'])
|
||||
|
||||
await projects['project-1'].has('is-positive')
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
projects['project-1'].has('is-positive')
|
||||
projects['project-2'].hasNot('is-negative')
|
||||
})
|
||||
|
||||
test('set recursive-install to false would install as --filter {.}...', async () => {
|
||||
@@ -498,5 +498,5 @@ test('set recursive-install to false would install as --filter {.}...', async ()
|
||||
process.chdir('project-1')
|
||||
await execPnpm(['install'])
|
||||
|
||||
await projects['project-2'].has('is-negative')
|
||||
projects['project-2'].has('is-negative')
|
||||
})
|
||||
|
||||
@@ -29,17 +29,17 @@ test('`pnpm recursive rebuild` specific dependencies', async () => {
|
||||
|
||||
await execPnpm(['recursive', 'install', '--ignore-scripts'])
|
||||
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
|
||||
await execPnpm(['recursive', 'rebuild', 'install-scripts-example-for-pnpm'])
|
||||
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
|
||||
{
|
||||
const generatedByPreinstall = projects['project-1'].requireModule('install-scripts-example-for-pnpm/generated-by-preinstall')
|
||||
|
||||
@@ -161,8 +161,8 @@ skipOnWindows('uploading cache can be disabled without breaking install', async
|
||||
await expect(execPnpm(['add', '--side-effects-cache', 'diskusage@1.1.3'])).resolves.not.toThrow()
|
||||
|
||||
// make sure the installation is successful, but the cache has not been written
|
||||
await project.has('diskusage')
|
||||
const storePath = await project.getStorePath()
|
||||
project.has('diskusage')
|
||||
const storePath = project.getStorePath()
|
||||
const engine = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`
|
||||
const cacheDir = path.join(storePath, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${engine}/package`)
|
||||
await expect(pathExists(cacheDir)).resolves.toBeFalsy()
|
||||
|
||||
@@ -13,13 +13,13 @@ test('uninstall package and remove from appropriate property', async () => {
|
||||
// npm@5 introduced --save-prod that behaves the way --save worked in pre 5 versions
|
||||
await execPnpm(['uninstall', 'is-positive'])
|
||||
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
|
||||
await execPnpm(['store', 'prune'])
|
||||
|
||||
await project.storeHasNot('is-positive', '3.1.0')
|
||||
project.storeHasNot('is-positive', '3.1.0')
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
project.hasNot('is-positive')
|
||||
|
||||
const pkgJson = await readPackageJsonFromDir(process.cwd())
|
||||
expect(pkgJson.optionalDependencies).toBeUndefined()
|
||||
|
||||
@@ -15,13 +15,13 @@ test('update <dep>', async () => {
|
||||
|
||||
await execPnpm(['install', '@pnpm.e2e/dep-of-pkg-with-1-dep@^100.0.0'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await execPnpm(['update', '@pnpm.e2e/dep-of-pkg-with-1-dep@latest'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('101.0.0')
|
||||
|
||||
const pkg = await readPackageJsonFromDir(process.cwd())
|
||||
@@ -38,7 +38,7 @@ test('update --no-save', async () => {
|
||||
|
||||
await execPnpm(['update', '--no-save'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foo@100.1.0'])
|
||||
|
||||
const pkg = await readPackageJsonFromDir(process.cwd())
|
||||
@@ -59,7 +59,7 @@ test('update', async () => {
|
||||
|
||||
await execPnpm(['update'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foo@100.1.0'])
|
||||
|
||||
const pkg = await readPackageJsonFromDir(process.cwd())
|
||||
@@ -130,7 +130,7 @@ test('recursive update --no-shared-workspace-lockfile', async function () {
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
await execPnpm(['recursive', 'update', '--no-shared-workspace-lockfile'])
|
||||
|
||||
const lockfile = await projects['project'].readLockfile()
|
||||
const lockfile = projects['project'].readLockfile()
|
||||
expect(lockfile.packages).toHaveProperty(['/@pnpm.e2e/foo@100.1.0'])
|
||||
|
||||
const pkg = await readPackageJsonFromDir(path.resolve('project'))
|
||||
@@ -150,9 +150,9 @@ test('update --latest', async function () {
|
||||
|
||||
await execPnpm(['update', '--latest'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('101.0.0')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/bar'].version).toBe('100.1.0')
|
||||
expect(lockfile.dependencies['alias'].version).toBe('/@pnpm.e2e/qar@100.1.0')
|
||||
@@ -177,9 +177,9 @@ test('update --latest --save-exact', async function () {
|
||||
|
||||
await execPnpm(['update', '--latest', '--save-exact'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '101.0.0')
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('101.0.0')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/bar'].version).toBe('100.1.0')
|
||||
expect(lockfile.dependencies['alias'].version).toBe('/@pnpm.e2e/qar@100.1.0')
|
||||
@@ -205,7 +205,7 @@ test('update --latest specific dependency', async function () {
|
||||
|
||||
await execPnpm(['update', '-L', '@pnpm.e2e/bar', 'alias', 'is-negative'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('100.0.0')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/bar'].version).toBe('100.1.0')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/foo'].version).toBe('100.0.0')
|
||||
@@ -232,7 +232,7 @@ test('update --latest --prod', async function () {
|
||||
|
||||
await execPnpm(['update', '--latest', '--prod'])
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
const lockfile = project.readLockfile()
|
||||
expect(lockfile.devDependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('100.0.0')
|
||||
expect(lockfile.dependencies['@pnpm.e2e/bar'].version).toBe('100.1.0')
|
||||
|
||||
@@ -240,7 +240,7 @@ test('update --latest --prod', async function () {
|
||||
expect(pkg.devDependencies?.['@pnpm.e2e/dep-of-pkg-with-1-dep']).toBe('100.0.0')
|
||||
expect(pkg.dependencies?.['@pnpm.e2e/bar']).toBe('^100.1.0')
|
||||
|
||||
await project.has('@pnpm.e2e/dep-of-pkg-with-1-dep') // not pruned
|
||||
project.has('@pnpm.e2e/dep-of-pkg-with-1-dep') // not pruned
|
||||
})
|
||||
|
||||
test('recursive update --latest on projects that do not share a lockfile', async () => {
|
||||
@@ -281,7 +281,7 @@ test('recursive update --latest on projects that do not share a lockfile', async
|
||||
'@pnpm.e2e/foo': '100.1.0',
|
||||
})
|
||||
|
||||
const lockfile1 = await projects['project-1'].readLockfile()
|
||||
const lockfile1 = projects['project-1'].readLockfile()
|
||||
expect(lockfile1.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('101.0.0')
|
||||
expect(lockfile1.dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
|
||||
@@ -291,7 +291,7 @@ test('recursive update --latest on projects that do not share a lockfile', async
|
||||
'@pnpm.e2e/foo': '100.1.0',
|
||||
})
|
||||
|
||||
const lockfile2 = await projects['project-2'].readLockfile()
|
||||
const lockfile2 = projects['project-2'].readLockfile()
|
||||
expect(lockfile2.dependencies['@pnpm.e2e/bar'].version).toBe('100.1.0')
|
||||
expect(lockfile2.dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
})
|
||||
@@ -340,12 +340,12 @@ test('recursive update --latest --prod on projects that do not share a lockfile'
|
||||
'@pnpm.e2e/foo': '100.0.0',
|
||||
})
|
||||
|
||||
const lockfile1 = await projects['project-1'].readLockfile()
|
||||
const lockfile1 = projects['project-1'].readLockfile()
|
||||
expect(lockfile1.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('101.0.0')
|
||||
expect(lockfile1.devDependencies['@pnpm.e2e/foo'].version).toBe('100.0.0')
|
||||
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].has('@pnpm.e2e/foo')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('@pnpm.e2e/foo')
|
||||
|
||||
const manifest2 = await readPackageJsonFromDir(path.resolve('project-2'))
|
||||
expect(manifest2.dependencies).toStrictEqual({
|
||||
@@ -355,12 +355,12 @@ test('recursive update --latest --prod on projects that do not share a lockfile'
|
||||
'@pnpm.e2e/bar': '100.0.0',
|
||||
})
|
||||
|
||||
const lockfile2 = await projects['project-2'].readLockfile()
|
||||
const lockfile2 = projects['project-2'].readLockfile()
|
||||
expect(lockfile2.devDependencies['@pnpm.e2e/bar'].version).toBe('100.0.0')
|
||||
expect(lockfile2.dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
|
||||
await projects['project-2'].has('@pnpm.e2e/bar')
|
||||
await projects['project-2'].has('@pnpm.e2e/foo')
|
||||
projects['project-2'].has('@pnpm.e2e/bar')
|
||||
projects['project-2'].has('@pnpm.e2e/foo')
|
||||
})
|
||||
|
||||
test('recursive update --latest specific dependency on projects that do not share a lockfile', async () => {
|
||||
@@ -404,7 +404,7 @@ test('recursive update --latest specific dependency on projects that do not shar
|
||||
'@pnpm.e2e/foo': '^100.1.0',
|
||||
})
|
||||
|
||||
const lockfile1 = await projects['project-1'].readLockfile()
|
||||
const lockfile1 = projects['project-1'].readLockfile()
|
||||
expect(lockfile1.dependencies['@pnpm.e2e/dep-of-pkg-with-1-dep'].version).toBe('100.0.0')
|
||||
expect(lockfile1.dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
expect(lockfile1.dependencies['alias'].version).toBe('/@pnpm.e2e/qar@100.1.0')
|
||||
@@ -415,7 +415,7 @@ test('recursive update --latest specific dependency on projects that do not shar
|
||||
'@pnpm.e2e/foo': '^100.1.0',
|
||||
})
|
||||
|
||||
const lockfile2 = await projects['project-2'].readLockfile()
|
||||
const lockfile2 = projects['project-2'].readLockfile()
|
||||
expect(lockfile2.dependencies['@pnpm.e2e/bar'].version).toBe('100.0.0')
|
||||
expect(lockfile2.dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
})
|
||||
@@ -531,10 +531,10 @@ test('recursive update --latest --prod on projects with a shared a lockfile', as
|
||||
expect(lockfile.importers['project-2'].devDependencies['@pnpm.e2e/bar'].version).toBe('100.0.0')
|
||||
expect(lockfile.importers['project-2'].dependencies['@pnpm.e2e/foo'].version).toBe('100.1.0')
|
||||
|
||||
await projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
await projects['project-1'].has('@pnpm.e2e/foo')
|
||||
await projects['project-2'].has('@pnpm.e2e/foo')
|
||||
await projects['project-2'].has('@pnpm.e2e/bar')
|
||||
projects['project-1'].has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
||||
projects['project-1'].has('@pnpm.e2e/foo')
|
||||
projects['project-2'].has('@pnpm.e2e/foo')
|
||||
projects['project-2'].has('@pnpm.e2e/bar')
|
||||
})
|
||||
|
||||
test('recursive update --latest specific dependency on projects with a shared a lockfile', async () => {
|
||||
@@ -600,13 +600,13 @@ test('deep update', async function () {
|
||||
|
||||
await execPnpm(['add', '@pnpm.e2e/pkg-with-1-dep'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await addDistTag('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0', 'latest')
|
||||
|
||||
await execPnpm(['update', '--depth', '1'])
|
||||
|
||||
await project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
project.storeHas('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0')
|
||||
})
|
||||
|
||||
test('update to latest without downgrading already defined prerelease (#7436)', async function () {
|
||||
|
||||
@@ -63,10 +63,10 @@ test('deploy', async () => {
|
||||
}, ['deploy'])
|
||||
|
||||
const project = assertProject(path.resolve('deploy'))
|
||||
await project.has('project-2')
|
||||
await project.has('is-positive')
|
||||
await project.hasNot('project-3')
|
||||
await project.hasNot('is-negative')
|
||||
project.has('project-2')
|
||||
project.has('is-positive')
|
||||
project.hasNot('project-3')
|
||||
project.hasNot('is-negative')
|
||||
expect(fs.existsSync('deploy/index.js')).toBeTruthy()
|
||||
expect(fs.existsSync('deploy/test.js')).toBeFalsy()
|
||||
expect(fs.existsSync('deploy/node_modules/.pnpm/file+project-2/node_modules/project-2/index.js')).toBeTruthy()
|
||||
@@ -157,8 +157,8 @@ test('forced deploy succeeds with a warning when destination directory exists an
|
||||
|
||||
// deployed successfully
|
||||
const project = assertProject(deployFullPath)
|
||||
await project.has('is-positive')
|
||||
await project.hasNot('is-negative')
|
||||
project.has('is-positive')
|
||||
project.hasNot('is-negative')
|
||||
expect(fs.existsSync('deploy/index.js')).toBeTruthy()
|
||||
expect(fs.existsSync('pnpm-lock.yaml')).toBeFalsy() // no changes to the lockfile are written
|
||||
|
||||
@@ -210,6 +210,6 @@ test('deploy with dedupePeerDependents=true ignores the value of dedupePeerDepen
|
||||
dedupePeerDependents: true, // This is ignored by deploy
|
||||
}, ['deploy'])
|
||||
const project = assertProject(path.resolve('deploy'))
|
||||
await project.has('is-positive')
|
||||
project.has('is-positive')
|
||||
expect(fs.existsSync('sub-dir/deploy')).toBe(false)
|
||||
})
|
||||
|
||||
@@ -106,7 +106,7 @@ test('recursive publish', async () => {
|
||||
expect(JSON.parse(stdout.toString())).toStrictEqual(pkg2.version)
|
||||
}
|
||||
|
||||
await projects[pkg1.name].writePackageJson({ ...pkg1, version: '2.0.0' })
|
||||
projects[pkg1.name].writePackageJson({ ...pkg1, version: '2.0.0' })
|
||||
|
||||
await publish.handler({
|
||||
...DEFAULT_OPTS,
|
||||
|
||||
@@ -26,7 +26,7 @@ test('pnpm store add express@4.16.3', async () => {
|
||||
}, ['add', 'express@4.16.3'])
|
||||
|
||||
const { cafsHas } = assertStore(path.join(storeDir, STORE_VERSION))
|
||||
await cafsHas('sha512-CDaOBMB9knI6vx9SpIxEMOJ6VBbC2U/tYNILs0qv1YOZc15K9U2EcF06v10F0JX6IYcWnKYZJwIDJspEHLvUaQ==')
|
||||
cafsHas('sha512-CDaOBMB9knI6vx9SpIxEMOJ6VBbC2U/tYNILs0qv1YOZc15K9U2EcF06v10F0JX6IYcWnKYZJwIDJspEHLvUaQ==')
|
||||
})
|
||||
|
||||
test('pnpm store add scoped package that uses not the standard registry', async () => {
|
||||
@@ -51,7 +51,7 @@ test('pnpm store add scoped package that uses not the standard registry', async
|
||||
}, ['add', '@foo/no-deps@1.0.0'])
|
||||
|
||||
const { cafsHas } = assertStore(path.join(storeDir, STORE_VERSION))
|
||||
await cafsHas('@foo/no-deps', '1.0.0')
|
||||
cafsHas('@foo/no-deps', '1.0.0')
|
||||
})
|
||||
|
||||
test('should fail if some packages can not be added', async () => {
|
||||
|
||||
@@ -35,7 +35,7 @@ test('remove unreferenced packages', async () => {
|
||||
'--config.modules-cache-max-age=0',
|
||||
], { env: { npm_config_registry: REGISTRY } })
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
|
||||
const reporter = jest.fn()
|
||||
await store.handler({
|
||||
@@ -58,7 +58,7 @@ test('remove unreferenced packages', async () => {
|
||||
})
|
||||
)
|
||||
|
||||
await project.storeHasNot('is-negative', '2.1.0')
|
||||
project.storeHasNot('is-negative', '2.1.0')
|
||||
|
||||
reporter.mockClear()
|
||||
await store.handler({
|
||||
@@ -93,7 +93,7 @@ test.skip('remove packages that are used by project that no longer exist', async
|
||||
|
||||
await rimraf('node_modules')
|
||||
|
||||
await cafsHas(ssri.fromHex('f0d86377aa15a64c34961f38ac2a9be2b40a1187', 'sha1').toString())
|
||||
cafsHas(ssri.fromHex('f0d86377aa15a64c34961f38ac2a9be2b40a1187', 'sha1').toString())
|
||||
|
||||
const reporter = jest.fn()
|
||||
await store.handler({
|
||||
@@ -116,7 +116,7 @@ test.skip('remove packages that are used by project that no longer exist', async
|
||||
})
|
||||
)
|
||||
|
||||
await cafsHasNot(ssri.fromHex('f0d86377aa15a64c34961f38ac2a9be2b40a1187', 'sha1').toString())
|
||||
cafsHasNot(ssri.fromHex('f0d86377aa15a64c34961f38ac2a9be2b40a1187', 'sha1').toString())
|
||||
})
|
||||
|
||||
test('keep dependencies used by others', async () => {
|
||||
@@ -127,16 +127,16 @@ test('keep dependencies used by others', async () => {
|
||||
await execa('node', [pnpmBin, 'add', 'hastscript@3.0.0', '--save-dev', '--store-dir', storeDir, '--registry', REGISTRY])
|
||||
await execa('node', [pnpmBin, 'remove', 'camelcase-keys', '--store-dir', storeDir], { env: { npm_config_registry: REGISTRY } })
|
||||
|
||||
await project.storeHas('camelcase-keys', '3.0.0')
|
||||
await project.hasNot('camelcase-keys')
|
||||
project.storeHas('camelcase-keys', '3.0.0')
|
||||
project.hasNot('camelcase-keys')
|
||||
|
||||
await project.storeHas('camelcase', '3.0.0')
|
||||
project.storeHas('camelcase', '3.0.0')
|
||||
|
||||
await project.storeHas('map-obj', '1.0.1')
|
||||
await project.hasNot('map-obj')
|
||||
project.storeHas('map-obj', '1.0.1')
|
||||
project.hasNot('map-obj')
|
||||
|
||||
// all dependencies are marked as dev
|
||||
const lockfile = await project.readLockfile() as LockfileFile
|
||||
const lockfile = project.readLockfile() as LockfileFile
|
||||
expect(isEmpty(lockfile.packages)).toBeFalsy()
|
||||
|
||||
Object.entries(lockfile.packages ?? {}).forEach(([_, dep]) => {
|
||||
@@ -155,9 +155,9 @@ test('keep dependencies used by others', async () => {
|
||||
userConfig: {},
|
||||
}, ['prune'])
|
||||
|
||||
await project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
await project.storeHasNot('map-obj', '1.0.1')
|
||||
await project.storeHas('camelcase', '3.0.0')
|
||||
project.storeHasNot('camelcase-keys', '3.0.0')
|
||||
project.storeHasNot('map-obj', '1.0.1')
|
||||
project.storeHas('camelcase', '3.0.0')
|
||||
})
|
||||
|
||||
test('keep dependency used by package', async () => {
|
||||
@@ -179,7 +179,7 @@ test('keep dependency used by package', async () => {
|
||||
userConfig: {},
|
||||
}, ['prune'])
|
||||
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
})
|
||||
|
||||
test('prune will skip scanning non-directory in storeDir', async () => {
|
||||
@@ -209,7 +209,7 @@ test('prune does not fail if the store contains an unexpected directory', async
|
||||
|
||||
await execa('node', [pnpmBin, 'add', 'is-negative@2.1.0', '--store-dir', storeDir, '--registry', REGISTRY])
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
const alienDir = path.join(storeDir, 'v3/files/44/directory')
|
||||
fs.mkdirSync(alienDir)
|
||||
|
||||
@@ -245,7 +245,7 @@ test('prune removes alien files from the store if the --force flag is used', asy
|
||||
|
||||
await execa('node', [pnpmBin, 'add', 'is-negative@2.1.0', '--store-dir', storeDir, '--registry', REGISTRY])
|
||||
|
||||
await project.storeHas('is-negative', '2.1.0')
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
const alienDir = path.join(storeDir, 'v3/files/44/directory')
|
||||
fs.mkdirSync(alienDir)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ test('CLI fails when store status finds modified packages', async () => {
|
||||
await rimraf('node_modules/.pnpm/is-positive@3.1.0/node_modules/is-positive/index.js')
|
||||
|
||||
let err!: PnpmError & { modified: string[] }
|
||||
const modulesState = await project.readModulesManifest()
|
||||
const modulesState = project.readModulesManifest()
|
||||
try {
|
||||
await store.handler({
|
||||
cacheDir,
|
||||
@@ -80,7 +80,7 @@ test('CLI does not fail when store status does not find modified packages', asyn
|
||||
'--verify-store-integrity',
|
||||
])
|
||||
|
||||
const modulesState = await project.readModulesManifest()
|
||||
const modulesState = project.readModulesManifest()
|
||||
await store.handler({
|
||||
cacheDir,
|
||||
dir: process.cwd(),
|
||||
|
||||
Reference in New Issue
Block a user