-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: reland run global after() hook earlier
This commit reverts the revert in bb52656. It also includes the fix for the issue that required the revert (#49059 (comment)) and an additional common.mustCall() in the added test. Refs: #49059 Refs: #49110 PR-URL: #49116 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
- Loading branch information
Showing
7 changed files
with
104 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
test/fixtures/test-runner/output/async-test-scheduling.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as common from '../../../common/index.mjs'; | ||
import { describe, test } from 'node:test'; | ||
import { setTimeout } from 'node:timers/promises'; | ||
|
||
test('test', common.mustCall()); | ||
describe('suite', common.mustCall(async () => { | ||
test('test', common.mustCall()); | ||
await setTimeout(10); | ||
test('scheduled async', common.mustCall()); | ||
})); | ||
|
||
await setTimeout(10); | ||
test('scheduled async', common.mustCall()); |
37 changes: 37 additions & 0 deletions
37
test/fixtures/test-runner/output/async-test-scheduling.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
TAP version 13 | ||
# Subtest: test | ||
ok 1 - test | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite | ||
# Subtest: test | ||
ok 1 - test | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: scheduled async | ||
ok 2 - scheduled async | ||
--- | ||
duration_ms: * | ||
... | ||
1..2 | ||
ok 2 - suite | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
... | ||
# Subtest: scheduled async | ||
ok 3 - scheduled async | ||
--- | ||
duration_ms: * | ||
... | ||
1..3 | ||
# tests 4 | ||
# suites 1 | ||
# pass 4 | ||
# fail 0 | ||
# cancelled 0 | ||
# skipped 0 | ||
# todo 0 | ||
# duration_ms * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/parallel/test-runner-root-after-with-refed-handles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { before, after, test } = require('node:test'); | ||
const { createServer } = require('node:http'); | ||
|
||
let server; | ||
|
||
before(common.mustCall(() => { | ||
server = createServer(); | ||
|
||
return new Promise(common.mustCall((resolve, reject) => { | ||
server.listen(0, common.mustCall((err) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
})); | ||
})); | ||
})); | ||
|
||
after(common.mustCall(() => { | ||
server.close(common.mustCall()); | ||
})); | ||
|
||
test(); |