New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix yarn check --integrity behavior not aligning with yarn install's integrity checking #2024
Conversation
@bouk, that is a great find, thanks! |
There don't seem to be any tests for check currently, but I'll see what I can do |
You can use the install.js tests for the check function |
I have added a test that checks whether a yarn install --flat followed by a yarn check --integrity --flat succeeds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Could you just add an explicit integrity check to the test?
test.concurrent('check and install should verify integrity in the same way when flat', (): Promise<void> => { | ||
// A@2.0.1 -> B@2.0.0 | ||
// should result in B@2.0.0 flattened | ||
return runInstall({flat: true, integrity: true}, 'install-should-dedupe-avoiding-conflicts-1', async (config) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runInstall has an implicit check to verify that all install operations are consistent.
It would be better to run an explicit check with integrity flag because we may refactor runInstall eventually and this test would be hard to keep consistent.
@bestander done! |
@@ -23,7 +23,7 @@ export const runInstall = run.bind( | |||
async (args, flags, config, reporter, lockfile): Promise<Install> => { | |||
const install = new Install(flags, config, reporter, lockfile); | |||
await install.init(); | |||
await check(config, reporter, {}, []); | |||
await check(config, reporter, flags, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should pass flags for install and check via the same variable.
Can you please revert this change?
@bouk. thanks, great job! |
Summary
There's a mismatch between what
yarn install
does for integrity checking and whatyarn check
does.yarn check
flattens the patterns, whileyarn check
doesn't, as it just uses Install.hydrate (which doesn't return the patterns flattened)We ran into some issues where
yarn install
would say everything was file whileyarn check --integrity
would say there's a mismatch. This patch fixes it