-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Version
v20.5.0
Platform
mac
Subsystem
test_runner
What steps will reproduce the bug?
Considder the following test:
const { before, after, test } = require('node:test')
const { createServer } = require('http')
let server
before(async () => {
console.log('before');
server = createServer((req, res) => {
res.end('hello')
})
await new Promise((resolve, reject) => {
server.listen(0, (err) => {
if (err) reject(err)
else resolve()
})
})
})
after(() => {
console.log('after');
server.close()
})
test('something', () => {
console.log('test');
})
We are trying to dispose of a server (or a connection to a DB) inside a global after but the global after is never run.
How often does it reproduce? Is there a required condition?
all the times
What is the expected behavior? Why is that the expected behavior?
for the test to pass / the after hook to be executed
What do you see instead?
the after hook is not executed and therefore the test never terminates
Additional information
No response
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.