Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: more changes to the new lockfile format
- Loading branch information
Showing
4 changed files
with
193 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ dependencies: | |
packages: | ||
/foo/1.0.0: | ||
/foo@1.0.0: | ||
resolution: {integrity: sha1-ChbBDewTLAqLCzb793Fo5VDvg/g=} | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { convertToInlineSpecifiersFormat, revertFromInlineSpecifiersFormat } from '../lib/experiments/inlineSpecifiersLockfileConverters' | ||
|
||
test('convertToInlineSpecifiersFormat()', () => { | ||
const lockfileV5 = { | ||
lockfileVersion: 5.0, | ||
importers: { | ||
project1: { | ||
specifiers: { | ||
foo: '^1.0.0', | ||
bar: '^1.0.0', | ||
qar: '^1.0.0', | ||
tarball: '^1.0.0', | ||
}, | ||
dependencies: { | ||
foo: '1.0.0', | ||
tarball: '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz', | ||
}, | ||
devDependencies: { | ||
bar: '/@bar/bar/1.0.0_@babel+core@2.0.0', | ||
}, | ||
optionalDependencies: { | ||
qar: 'reg.com/qar/1.0.0', | ||
}, | ||
}, | ||
}, | ||
packages: { | ||
'/foo/1.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'/@bar/bar/1.0.0_@babel+core@2.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'reg.com/qar/1.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz': { | ||
resolution: { integrity: '' }, | ||
}, | ||
}, | ||
} | ||
const lockfileV6 = { | ||
lockfileVersion: '5-inlineSpecifiers', | ||
importers: { | ||
project1: { | ||
dependencies: { | ||
foo: { | ||
specifier: '^1.0.0', | ||
version: '1.0.0', | ||
}, | ||
tarball: { | ||
specifier: '^1.0.0', | ||
version: '@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz', | ||
}, | ||
}, | ||
devDependencies: { | ||
bar: { | ||
specifier: '^1.0.0', | ||
version: '/@bar/bar@1.0.0_@babel+core@2.0.0', | ||
}, | ||
}, | ||
optionalDependencies: { | ||
qar: { | ||
specifier: '^1.0.0', | ||
version: 'reg.com/qar@1.0.0', | ||
}, | ||
}, | ||
}, | ||
}, | ||
packages: { | ||
'/foo@1.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'/@bar/bar@1.0.0_@babel+core@2.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'reg.com/qar@1.0.0': { | ||
resolution: { integrity: '' }, | ||
}, | ||
'@registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz': { | ||
resolution: { integrity: '' }, | ||
}, | ||
}, | ||
} | ||
expect(convertToInlineSpecifiersFormat(lockfileV5)).toEqual(lockfileV6) | ||
expect(revertFromInlineSpecifiersFormat(lockfileV6)).toEqual(lockfileV5) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters