0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-runner-root-after-with-refed-handles.js
Colin Ihrig b5740756ca
test_runner: reland run global after() hook earlier
This commit reverts the revert in
bb52656fc6. It also includes the
fix for the issue that required the revert
(https://github.com/nodejs/node/pull/49059#issuecomment-1675171959)
and an additional common.mustCall() in the added test.

Refs: https://github.com/nodejs/node/pull/49059
Refs: https://github.com/nodejs/node/pull/49110
PR-URL: https://github.com/nodejs/node/pull/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>
2023-08-14 14:29:29 +00:00

27 lines
514 B
JavaScript

'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();