-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(resolutions): Warn instead of erroring if unmatched dependency ma…
…tches resolutions with glob support Summary PR #4835 fixed `yarn check` while using simple resolutions keys. This PR fixes `yarn check` while using resolutions keys with globs or dep trees. Test plan New test case added.
- Loading branch information
1 parent
c53d039
commit 460ffea
Showing
22 changed files
with
1,144 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,7 +383,9 @@ test.concurrent('should ignore bundled dependencies', async (): Promise<void> => | |
); | ||
}); | ||
|
||
test.concurrent('should warn about mismatched dependencies if they match resolutions', async (): Promise<void> => { | ||
test.concurrent('should warn about mismatched dependencies if they match resolutions (simple)', async (): Promise< | ||
void, | ||
> => { | ||
let mismatchError = false; | ||
let stdout = ''; | ||
try { | ||
|
@@ -401,6 +403,46 @@ test.concurrent('should warn about mismatched dependencies if they match resolut | |
).toBeGreaterThan(-1); | ||
}); | ||
|
||
test.concurrent('should warn about mismatched dependencies if they match resolutions (tree)', async (): Promise< | ||
void, | ||
> => { | ||
let mismatchError = false; | ||
let stdout = ''; | ||
try { | ||
await runCheck([], {}, 'resolutions-tree', (config, reporter, check, getStdout) => { | ||
stdout = getStdout(); | ||
}); | ||
} catch (err) { | ||
mismatchError = true; | ||
} | ||
expect(mismatchError).toEqual(false); | ||
expect( | ||
stdout.search( | ||
`warning.*"[email protected]" is incompatible with requested version "pad-left#repeat-string@\\^1.5.4"`, | ||
), | ||
).toBeGreaterThan(-1); | ||
}); | ||
|
||
test.concurrent('should warn about mismatched dependencies if they match resolutions (glob)', async (): Promise< | ||
void, | ||
> => { | ||
let mismatchError = false; | ||
let stdout = ''; | ||
try { | ||
await runCheck([], {}, 'resolutions-glob', (config, reporter, check, getStdout) => { | ||
stdout = getStdout(); | ||
}); | ||
} catch (err) { | ||
mismatchError = true; | ||
} | ||
expect(mismatchError).toEqual(false); | ||
expect( | ||
stdout.search( | ||
`warning.*"[email protected]" is incompatible with requested version "pad-left#repeat-string@\\^1.5.4"`, | ||
), | ||
).toBeGreaterThan(-1); | ||
}); | ||
|
||
test.concurrent('--integrity should throw an error if top level patterns do not match', async (): Promise<void> => { | ||
let integrityError = false; | ||
try { | ||
|
22 changes: 22 additions & 0 deletions
22
__tests__/fixtures/check/resolutions-glob/node_modules/.yarn-integrity
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
__tests__/fixtures/check/resolutions-glob/node_modules/pad-left/LICENSE
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
134 changes: 134 additions & 0 deletions
134
__tests__/fixtures/check/resolutions-glob/node_modules/pad-left/README.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
__tests__/fixtures/check/resolutions-glob/node_modules/pad-left/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
88 changes: 88 additions & 0 deletions
88
__tests__/fixtures/check/resolutions-glob/node_modules/pad-left/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.