-
-
Notifications
You must be signed in to change notification settings - Fork 33k
test_runner: fix global timeout propagation #59732
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
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #59732 +/- ##
==========================================
+ Coverage 89.83% 89.92% +0.09%
==========================================
Files 667 667
Lines 196175 196772 +597
Branches 38548 38410 -138
==========================================
+ Hits 176228 176946 +718
+ Misses 12408 12264 -144
- Partials 7539 7562 +23
🚀 New features to boost your workflow:
|
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.
Hi Pietro! Thanks a lot for taking the time to investigate and patch!
I will need to take some time to look more deeply into the root cause either tonight or the end of this week, just being too swamped lately ;p
With my quick look, I think this current patch might not be the solution yet - as
import { test, suite } from "node:test";
suite("baa", { timeout: 20 }, () => {
test("tee", {timeout: 3000}, async () => {
console.log("tee");
await new Promise((res) => { setTimeout(res, 1500) });
})
})
Would fail the test, seems timeout 3000
missed its chance.
Hey @jakecastelli 🚀
The problem here is that, for the suite, timeout is a no-op and is overridden to null by default. Note: suite("baa", { timeout: 20 }, () => {
test("tee", {timeout: 3000}, async () => {
console.log("tee");
await new Promise((res) => { setTimeout(res, 1500) });
})
}) In this case, I would expect the test to fail after 20ms, as the root test has a timeout of 20ms. |
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.
please see my comment in the original issue. I think the behavior is expected, but lets discuss that in the issue.
This should address #59701!
While checking this implementation, I also came across this:
[https://github.com/nodejs/node/blob/737b42e4eeaf975ae11d15887898fb99f0e8da1c/lib/internal/test_runner/test.js#L1454-L1459](
node/lib/internal/test_runner/test.js
Lines 1454 to 1459 in 737b42e
I'm wondering if this behavior is well documented and working as intended.
Currently, this option is a no-op even if provided.
cc @jakecastelli