mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

Refs: https://github.com/nodejs/node/issues/31763 This test would have helped us catch the noisy output from http2 earlier. Currently none of the tests fail if there is unexpected debug output. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/37447 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
41 lines
830 B
JavaScript
41 lines
830 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
hasCrypto,
|
|
mustCall,
|
|
skip
|
|
} = require('../common');
|
|
if (!hasCrypto)
|
|
skip('missing crypto');
|
|
|
|
const {
|
|
strictEqual
|
|
} = require('assert');
|
|
const {
|
|
createServer,
|
|
connect
|
|
} = require('http2');
|
|
const {
|
|
spawnSync
|
|
} = require('child_process');
|
|
|
|
// Validate that there is no unexpected output when
|
|
// using http2
|
|
if (process.argv[2] !== 'child') {
|
|
const {
|
|
stdout, stderr, status
|
|
} = spawnSync(process.execPath, [__filename, 'child'], { encoding: 'utf8' });
|
|
strictEqual(stderr, '');
|
|
strictEqual(stdout, '');
|
|
strictEqual(status, 0);
|
|
} else {
|
|
const server = createServer();
|
|
server.listen(0, mustCall(() => {
|
|
const client = connect(`http://localhost:${server.address().port}`);
|
|
client.on('connect', mustCall(() => {
|
|
client.close();
|
|
server.close();
|
|
}));
|
|
}));
|
|
}
|