-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move debugger test case to parallel
Move test case that does not require a predetermined port to parallel. PR-URL: #39300 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
- Loading branch information
Showing
2 changed files
with
36 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters