Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate tests to use node:test module for better test structure for sequential #56039

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions test/sequential/test-debugger-custom-port.js
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());
});
});
13 changes: 8 additions & 5 deletions test/sequential/test-worker-heapsnapshot-options.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');

require('../common');

const { recordState, getHeapSnapshotOptionTests } = require('../common/heap');
const { Worker } = require('worker_threads');
const { once } = require('events');
const { Worker } = require('node:worker_threads');
const { once } = require('node:events');
const { test } = require('node:test');

(async function() {
test('should handle heap snapshot options correctly in Worker threads', async () => {
const tests = getHeapSnapshotOptionTests();
const w = new Worker(tests.fixtures);

Expand All @@ -18,4 +21,4 @@ const { once } = require('events');
}

await w.terminate();
})().then(common.mustCall());
});
Loading