-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Version
v20.0.0
Platform
Darwin Rochs-MBP.localdomain 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64
Subsystem
node:test
What steps will reproduce the bug?
const { describe, beforeEach, it } = require('node:test')
describe('Root', () => {
beforeEach(() => {
console.log('test') // only prints when the Nested context is entered
})
describe('Nested', () => {
it('should run beforeEach in first test', () => {
// always pass
})
it('should run beforeEach in second test', () => {
// always pass
})
it('should run beforeEach in third test', () => {
// always pass
})
})
})How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
beforeEach and afterEach should be running before every test even when nested, not when the nested suite starts running.
What do you see instead?
beforeEach and afterEach only run once for nested test suites.
Additional information
No response
meyfa
Metadata
Metadata
Assignees
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.