GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_runner: pass abortSignal to test files · nodejs/node@2c72ed8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • runner.js
  • test/parallel
    • test-runner-run.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/runner.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/runner.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class FileTest extends Test {
361361

362362
function runTestFile(path, filesWatcher, opts) {
363363
const watchMode = filesWatcher != null;
364-
const subtest = opts.root.createSubtest(FileTest, path, async (t) => {
364+
const subtest = opts.root.createSubtest(FileTest, path, { __proto__: null, signal: opts.signal }, async (t) => {
365365
const args = getRunArgs(path, opts);
366366
const stdio = ['pipe', 'pipe', 'pipe'];
367367
const env = { __proto__: null, ...process.env, NODE_TEST_CONTEXT: 'child-v8' };
Collapse file

‎test/parallel/test-runner-run.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-run.mjs
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
184184
});
185185

186186
describe('AbortSignal', () => {
187+
it('should accept a signal', async () => {
188+
const stream = run({ signal: AbortSignal.timeout(50), files: [
189+
fixtures.path('test-runner', 'never_ending_sync.js'),
190+
fixtures.path('test-runner', 'never_ending_async.js'),
191+
] });
192+
stream.on('test:fail', common.mustCall(2));
193+
stream.on('test:pass', common.mustNotCall());
194+
// eslint-disable-next-line no-unused-vars
195+
for await (const _ of stream);
196+
});
197+
187198
it('should stop watch mode when abortSignal aborts', async () => {
188199
const controller = new AbortController();
189200
const result = await run({

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.