mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
27 lines
514 B
JavaScript
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();
|