-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate tests to use node:test module for better test structure
- Loading branch information
Mert Can Altin
committed
Nov 27, 2024
1 parent
585f7bc
commit c086664
Showing
2 changed files
with
24 additions
and
18 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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
const fixtures = require('../common/fixtures'); | ||
const startCLI = require('../common/debugger'); | ||
const assert = require('node:assert'); | ||
const { test } = require('node:test'); | ||
|
||
const assert = require('assert'); | ||
// Skip if the inspector is disabled | ||
common.skipIfInspectorDisabled(); | ||
|
||
// Custom port. | ||
const script = fixtures.path('debugger', 'three-lines.js'); | ||
test('should start CLI debugger with custom port and validate output', async (t) => { | ||
const script = fixtures.path('debugger', 'three-lines.js'); | ||
const cli = startCLI([`--port=${common.PORT}`, script]); | ||
|
||
const cli = startCLI([`--port=${common.PORT}`, script]); | ||
(async function() { | ||
try { | ||
await t.test('validate debugger prompt and output', async () => { | ||
await cli.waitForInitialBreak(); | ||
await cli.waitForPrompt(); | ||
|
||
assert.match(cli.output, /debug>/, 'prints a prompt'); | ||
assert.match( | ||
cli.output, | ||
new RegExp(`< Debugger listening on [^\n]*${common.PORT}`), | ||
'forwards child output'); | ||
} finally { | ||
'forwards child output' | ||
); | ||
}); | ||
|
||
await t.test('ensure CLI exits with code 0', async () => { | ||
const code = await cli.quit(); | ||
assert.strictEqual(code, 0); | ||
} | ||
})().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