-
Notifications
You must be signed in to change notification settings - Fork 28.6k
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
test_runner: fix delete test file cause dependency file change not rerun the tests #53533
base: main
Are you sure you want to change the base?
test_runner: fix delete test file cause dependency file change not rerun the tests #53533
Conversation
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.
Review requested:
|
@@ -0,0 +1,100 @@ | |||
// Flags: --expose-internals |
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.
Is this used only for util.createDeferredPromise
?
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.
yes, it only used for util.createDeferredPromise
Co-authored-by: Chemi Atlow <chemi@atlow.co.il>
d79b8d7
to
e270e58
Compare
maybe we can get CI started again? 👀 |
let currentRun = ''; | ||
const runs = []; | ||
|
||
child.stdout.on('data', (data) => { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just make sure to not await it before you trigger the watch)
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.
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 is an edge case left from #53114
Reproduce step:
You would observe that
test-b.mjs
andtest-c.mjs
are not being rerun. The expected behaviour should betest-b.mjs
,test-c.mjs
being 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
dependencyOwners
wouldn'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.mjs
but 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