forked from snyk/nodejs-lockfile-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug: yarn 2 lock file parsing issues snyk#56
- Loading branch information
Showing
2 changed files
with
62 additions
and
7 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 |
---|---|---|
|
@@ -19,12 +19,22 @@ test('Should work for semver resolution with npm protocol and scope', async (t) | |
t.deepEqual(key, [ '@types/istanbul-reports@^1.1.1'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for fixed version', async (t) => { | ||
test('Should work for tag resolution with npm protocol', async (t) => { | ||
const key = normalizer('body-parser@npm:latest'); | ||
t.deepEqual(key, [ 'body-parser@latest'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for tag resolution with npm protocol and scope', async (t) => { | ||
const key = normalizer('@types/istanbul-reports@npm:latest'); | ||
t.deepEqual(key, [ '@types/istanbul-reports@latest'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for semver without protocol', async (t) => { | ||
const key = normalizer('[email protected]'); | ||
t.deepEqual(key, [ '[email protected]'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for fixed version and scope', async (t) => { | ||
test('Should work for semver with scope and without protocol', async (t) => { | ||
const key = normalizer('@types/[email protected]'); | ||
t.deepEqual(key, [ '@types/[email protected]'], 'Resolution is normalized'); | ||
}); | ||
|
@@ -39,7 +49,42 @@ test('Should work for git+ssh', async (t) => { | |
t.deepEqual(key, [ 'body-parser@git+ssh://[email protected]/expressjs/body-parser.git#1.9.0"'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for patch protocol', async (t) => { | ||
const key = normalizer('fsevents@patch:fsevents@^1.2.7#builtin<compat/fsevents>'); | ||
t.deepEqual(key, [ 'fsevents@^1.2.7'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for short github protocol with tag', async (t) => { | ||
const key = normalizer('body-parser@expressjs/body-parser#1.9.0'); | ||
t.deepEqual(key, [ 'body-parser@expressjs/body-parser#1.9.0'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for shor github protocol without tag', async (t) => { | ||
const key = normalizer('body-parser@expressjs/body-parser'); | ||
t.deepEqual(key, [ 'body-parser@expressjs/body-parser'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for short github protocol with tag', async (t) => { | ||
const key = normalizer('body-parser@github:expressjs/body-parser#1.9.0'); | ||
t.deepEqual(key, [ 'body-parser@github:expressjs/body-parser#1.9.0'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for shor github protocol without tag', async (t) => { | ||
const key = normalizer('body-parser@github:expressjs/body-parser'); | ||
t.deepEqual(key, [ 'body-parser@github:expressjs/body-parser'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for file protocol', async (t) => { | ||
const key = normalizer('shared@file:./some-file::locator=pkg-dev-deps-only%40workspace%3A.'); | ||
t.deepEqual(key, [ 'shared@file:./some-file'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for link protocol', async (t) => { | ||
const key = normalizer('body-parser@link:../test2::locator=external-tarball%40workspace%3A.'); | ||
t.deepEqual(key, [ 'body-parser@link:../test2'], 'Resolution is normalized'); | ||
}); | ||
|
||
test('Should work for portal protocol', async (t) => { | ||
const key = normalizer('body-parser@portal:../test2::locator=external-tarball%40workspace%3A.'); | ||
t.deepEqual(key, [ 'body-parser@portal:../test2'], 'Resolution is normalized'); | ||
}); |