Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Version
v19.0.0
Platform
Darwin Rochs-MBP.localdomain 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
Subsystem
node:test
What steps will reproduce the bug?
When a test fails, the afterEach hook is not executed.
const{ test }=require('node:test')test('suite',asynct=>{t.beforeEach(()=>{console.log('beforeEach')})t.afterEach(()=>{console.log('afterEach')// this is never executed})awaitt.test('test',t=>{thrownewError('boom')})})How often does it reproduce? Is there a required condition?
This is always reproducible when the test fails.
What is the expected behavior?
The afterEach hook should always be executed, especially since it often serves as a way to clean up resources.
What do you see instead?
Only the code for beforeEach is executed.
Additional information
This also happens with the describe/it syntax.
Metadata
Metadata
Assignees
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.