mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: move debugger test case to parallel
Move test case that does not require a predetermined port to parallel. PR-URL: https://github.com/nodejs/node/pull/39300 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
This commit is contained in:
parent
debdc1dbb6
commit
6463adf183
36
test/parallel/test-debugger-unavailable-port.js
Normal file
36
test/parallel/test-debugger-unavailable-port.js
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
common.skipIfInspectorDisabled();
|
||||
|
||||
const fixtures = require('../common/fixtures');
|
||||
const startCLI = require('../common/debugger');
|
||||
|
||||
const assert = require('assert');
|
||||
const { createServer } = require('net');
|
||||
|
||||
// Launch w/ unavailable port.
|
||||
(async () => {
|
||||
const blocker = createServer((socket) => socket.end());
|
||||
const port = await new Promise((resolve, reject) => {
|
||||
blocker.on('error', reject);
|
||||
blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port));
|
||||
});
|
||||
|
||||
try {
|
||||
const script = fixtures.path('debugger', 'three-lines.js');
|
||||
const cli = startCLI([`--port=${port}`, script]);
|
||||
const code = await cli.quit();
|
||||
|
||||
assert.doesNotMatch(
|
||||
cli.output,
|
||||
/report this bug/,
|
||||
'Omits message about reporting this as a bug');
|
||||
assert.ok(
|
||||
cli.output.includes(`waiting for 127.0.0.1:${port} to be free`),
|
||||
'Tells the user that the port wasn\'t available');
|
||||
assert.strictEqual(code, 1);
|
||||
} finally {
|
||||
blocker.close();
|
||||
}
|
||||
})().then(common.mustCall());
|
@ -3,11 +3,9 @@ const common = require('../common');
|
||||
|
||||
common.skipIfInspectorDisabled();
|
||||
|
||||
const fixtures = require('../common/fixtures');
|
||||
const startCLI = require('../common/debugger');
|
||||
|
||||
const assert = require('assert');
|
||||
const { createServer } = require('net');
|
||||
|
||||
// Launch CLI w/o args.
|
||||
{
|
||||
@ -31,29 +29,3 @@ const { createServer } = require('net');
|
||||
assert.strictEqual(code, 1);
|
||||
});
|
||||
}
|
||||
|
||||
// Launch w/ unavailable port.
|
||||
(async () => {
|
||||
const blocker = createServer((socket) => socket.end());
|
||||
const port = await new Promise((resolve, reject) => {
|
||||
blocker.on('error', reject);
|
||||
blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port));
|
||||
});
|
||||
|
||||
try {
|
||||
const script = fixtures.path('debugger', 'three-lines.js');
|
||||
const cli = startCLI([`--port=${port}`, script]);
|
||||
const code = await cli.quit();
|
||||
|
||||
assert.doesNotMatch(
|
||||
cli.output,
|
||||
/report this bug/,
|
||||
'Omits message about reporting this as a bug');
|
||||
assert.ok(
|
||||
cli.output.includes(`waiting for 127.0.0.1:${port} to be free`),
|
||||
'Tells the user that the port wasn\'t available');
|
||||
assert.strictEqual(code, 1);
|
||||
} finally {
|
||||
blocker.close();
|
||||
}
|
||||
})().then(common.mustCall());
|
||||
|
Loading…
Reference in New Issue
Block a user