Skip to content

Commit

Permalink
fix(resolutions): Warn instead of erroring if unmatched dependency ma…
Browse files Browse the repository at this point in the history
…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
ramasilveyra committed Jun 26, 2018
1 parent c53d039 commit 460ffea
Show file tree
Hide file tree
Showing 22 changed files with 1,144 additions and 5 deletions.
44 changes: 43 additions & 1 deletion __tests__/commands/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.*"repeat-string@1.4.0" 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.*"repeat-string@1.4.0" 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 {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 460ffea

Please sign in to comment.