Uh oh!
There was an error while loading. Please reload this page.
test_runner: fix delete test file cause dependency file change not rerun the tests - #53533
Conversation
nodejs-github-bot
commented
Jun 21, 2024
Review requested:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Is this used only for util.createDeferredPromise?
There was a problem hiding this comment.
yes, it only used for util.createDeferredPromise
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d79b8d7 to
e270e58Comparejakecastelli
commented
Jul 7, 2024
maybe we can get CI started again? 👀 |
nodejs-github-bot
commented
Jul 7, 2024
There was a problem hiding this comment.
This could just be .toArray()on child.stdout which would also save the util.createDeferredPromise and would make it easier to listen to stdout
There was a problem hiding this comment.
(just make sure to not await it before you trigger the watch)
There was a problem hiding this comment.
Can I get a little bit of help here? I tried to use child.stdout.toArray() - but I cannot seem to be able to control the test runs, I cannot manage to get 2 runs (get result for initial run 3/3 pass, delete a test file modify another test to get the result of second run 2/2 pass) successfully, I can only get result for 1 run
I must be doing something incorrectly.
Would you mind explaining not await to what?
(just make sure to not await it before you trigger the watch)
There was a problem hiding this comment.
I think I may have understood what you mean - use child.stdout.toArray() to get a promise then delete a test file and update a file in order to trigger the rerun (watch), after that resolve the promise to get all the std out results, am I understanding correctly? 👀
jakecastelli
commented
Aug 6, 2024
Haven't got back from @benjamingr yet on #53533 (comment), shall we land this bug fix first and I can try to create a follow up PR to improve it. |
This comment was marked as outdated.
This comment was marked as outdated.
benjamingr
commented
Aug 6, 2024
SGTM |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Aug 7, 2024
When a watched test file is being deleted then the referenced dependency file(s) will be updated incorrect when `unfilterFilesOwnedBy` method is called, which will cause tests not being rerun when its referenced dependency changed. To prevent this case, we can simply `return` when we detect a watched test file being deleted.
Co-authored-by: Chemi Atlow <chemi@atlow.co.il>
nodejs-github-bot
commented
Aug 7, 2024
jakecastelli
commented
Aug 8, 2024
I figured out the watch capability is limited in AIX which caused the test in CI on that platform to fail. |
a82efaa to
b1e06fcCompareCodecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #53533 +/- ##
==========================================
- Coverage 87.10% 87.10% -0.01%
==========================================
Files 647 647 Lines 181739 181759 +20 Branches 34887 34889 +2 ==========================================
+ Hits 158310 158323 +13 - Misses 16738 16740 +2 - Partials 6691 6696 +5
|
nodejs-github-bot
commented
Aug 8, 2024
nodejs-github-bot
commented
Aug 8, 2024
nodejs-github-bot
commented
Aug 8, 2024
jakecastelli
commented
Aug 8, 2024
Green CI now 🥳 would appreciate someone can take a look again and give a green tick so this PR is able to land (my latest change was skipping the test on AIX platform as the watch capability is restricted) |
jakecastelli
commented
Aug 12, 2024
@mcollina do you mind taking a quick look 🙏 as you recently did some work in this area as well |
nodejs-github-bot
commented
Aug 14, 2024
Landed in 1212eca |
When a watched test file is being deleted then the referenced dependency file(s) will be updated incorrect when `unfilterFilesOwnedBy` method is called, which will cause tests not being rerun when its referenced dependency changed. To prevent this case, we can simply `return` when we detect a watched test file being deleted. PR-URL: #53533 Refs: #53114 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
There is an edge case left from #53114
Reproduce step:
You would observe that
test-b.mjsandtest-c.mjsare not being rerun. The expected behaviour should betest-b.mjs,test-c.mjsbeing rerun and failed (sinceassert.strictEqual(a, 1)is not correct anymore).Change explain:
When a watched test file is being deleted, the test runner will rerun the test(s) and because the test file is no longer there but the
dependencyOwnerswouldn't be able to know it, so it failed in silence. Since a test file is being deleted, we don't need to rerun anything so we can just safelyreturn.notes:
The test is quite identical to
test/parallel/test-runner-watch-mode.mjsbut with a more complicated setup, I am thinking to spend some time to see how I can refactor the test so we can write more complicated test cases in the future, I am committed and would like to do a separate PR for it.Ref: #53114