fix(vitest): test deep dependencies change detection#4934
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
27e50f0 to
4e5589a
Compare
hi-ogawa
left a comment
There was a problem hiding this comment.
Thanks for the PR! (also reproduction and your analysis are awesome!)
This looks like a bug to me since the same logic is also used for vitest related https://vitest.dev/guide/cli.html#vitest-related and it also misses deep dependency. I checked it based on your repro https://stackblitz.com/edit/github-ndav2w?file=package.json
For the sake of verifying this PR, I don't think setting up new tests for --changed is necessary (actually there seems none currently probably because it's tedious to setup git), but It would be great if you can expand existing tests in test/changed/fixtures/related to show that deep dependencies is covered.
sheremet-va
left a comment
There was a problem hiding this comment.
Let's add a test case for this change. The tests for this feature are located in test/changed
0f98151 to
3bfbfc8
Compare
`--changed` flag is not correctly looking up deep dependencies, as such the changed flag does not trigger specs if a sub dependency is changed. Alters the logic to add the collected dependency after recursive `addImports` is called, otherwise the logic returns early because that dependency has already been added to the collected deps set. So it will not look deeply.
3bfbfc8 to
89678fc
Compare
|
@sheremet-va @hi-ogawa i've added the relevant tests (including imports / re-export syntax). I also tested locally to ensure that the specs fail if the changes are not applied. |
--changedflag is not correctly looking up deep dependencies, as such the changed flag does not trigger specs if a sub dependency is changed.Alters the logic to add the collected dependency after recursive
addImportsis called, otherwise the logic returns early because that dependency has already been added to the collected deps set. So it will not look deeply.Resolves #4933
(Also Resolves #5009)