mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
fix: pnpm add @teambit/bit should succeed (#4813)
This commit is contained in:
6
.changeset/wet-needles-remain.md
Normal file
6
.changeset/wet-needles-remain.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Correctly detect repeated dependency sequence during resolution.
|
||||
27
packages/core/test/install/deepRecursive.ts
Normal file
27
packages/core/test/install/deepRecursive.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { prepareEmpty } from '@pnpm/prepare'
|
||||
import { addDependenciesToPackage } from '@pnpm/core'
|
||||
import isCI from 'is-ci'
|
||||
import exists from 'path-exists'
|
||||
import { testDefaults } from '../utils'
|
||||
|
||||
const testSkipOnCI = isCI ? test.skip : test
|
||||
|
||||
// Looks like GitHub Actions have reduced memory limit for Node.js,
|
||||
// so it fails in CI at the moment.
|
||||
testSkipOnCI('a package with a huge amount of circular dependencies and many peer dependencies should successfully be resolved', async () => {
|
||||
prepareEmpty()
|
||||
|
||||
await addDependenciesToPackage({},
|
||||
['@teambit/bit@0.0.745'],
|
||||
await testDefaults({
|
||||
fastUnpack: true,
|
||||
lockfileOnly: true,
|
||||
registries: {
|
||||
'@teambit': 'https://node.bit.dev/',
|
||||
},
|
||||
strictPeerDependencies: false,
|
||||
})
|
||||
)
|
||||
|
||||
expect(await exists('pnpm-lock.yaml')).toBeTruthy()
|
||||
})
|
||||
@@ -3,8 +3,8 @@ export function nodeIdContainsSequence (nodeId: string, pkgId1: string, pkgId2:
|
||||
pkgIds.pop()
|
||||
const pkg1Index = pkgIds.indexOf(pkgId1)
|
||||
if (pkg1Index === -1) return false
|
||||
const pkg2Index = pkgIds.indexOf(pkgId2)
|
||||
return pkg2Index > -1 && pkg1Index < pkg2Index
|
||||
const pkg2Index = pkgIds.lastIndexOf(pkgId2)
|
||||
return pkg1Index < pkg2Index
|
||||
}
|
||||
|
||||
export function createNodeId (parentNodeId: string, pkgId: string) {
|
||||
|
||||
5
packages/resolve-dependencies/test/nodeIdUtils.test.ts
Normal file
5
packages/resolve-dependencies/test/nodeIdUtils.test.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { nodeIdContainsSequence } from '../lib/nodeIdUtils'
|
||||
|
||||
test('nodeIdContainsSequence()', () => {
|
||||
expect(nodeIdContainsSequence('>.>b>a>c>b>a>', 'a', 'b')).toBeTruthy()
|
||||
})
|
||||
Reference in New Issue
Block a user