Compare commits

...

1 Commits

Author SHA1 Message Date
Ashcon Partovi
7fa2fa0fa0 fix: test-http-listening.js 2025-03-21 14:39:03 -07:00
2 changed files with 17 additions and 0 deletions

View File

@@ -749,6 +749,7 @@ const ServerPrototype = {
return;
}
this[serverSymbol] = undefined;
this.listening = false;
if (typeof optionalCallback === "function") this.once("close", optionalCallback);
server.stop();
},

View File

@@ -0,0 +1,16 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
const server = http.createServer();
assert.strictEqual(server.listening, false);
server.listen(0, common.mustCall(() => {
assert.strictEqual(server.listening, true);
server.close(common.mustCall(() => {
assert.strictEqual(server.listening, false);
}));
}));