-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Example code from docs results in 'failed running afterEach hook' #44449
Comments
I looks like a The following code works fine: import test from 'node:test';
import assert from 'node:assert';
test('top level test', async (t) => {
t.afterEach((t) => {
assert.ok('ok')
});
await t.test(
'This is a subtest',
(t) => {
assert.ok('some relevant assertion here');
}
);
}); |
I think this was fixed here #44351, |
Hi Yeah @MoLow changing to But it appears the By running the following code: import test from 'node:test';
import assert from 'node:assert';
test('top level test', async (t) => {
t.afterEach((t) => {
t.diagnostics(`finished running ${t.name}`)
});
await t.test(
'This is a subtest',
(t) => {
assert.ok('some relevant assertion here');
}
);
}); We should have seen:
Should I create a new issue for this? |
@markwylde thanks, that was fixed as well #44284 |
Version
v18.8.0
Platform
Linux pop-os 5.19.0-76051900-generic ~22.04 SMP PREEMPT_DYNAMIC Thu A x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Create a
test.js
file anywhere with the contents from the official node docs:https://nodejs.org/api/test.html#contextaftereach-fn-options
I added imports resulting in the following code:
Run the test:
node test.js
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior?
That the test passes.
What do you see instead?
Additional information
I'm still not sure if this is an issue with the documentation or a bug with Node. I choose bug with node as it feels like that code should pass.
The text was updated successfully, but these errors were encountered: