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: report load errors with --test-isolation=none · nodejs/node@563cb24

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • runner.js
  • test
    • fixtures/test-runner
      • throws-after-test.mjs
    • parallel
      • test-runner-no-isolation-load-error.js
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
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,8 @@ function run(options = kEmptyObject) {
11461146
topLevelTestCount,
11471147
root.subtests.length,
11481148
);
1149-
if (topLevelTestCount === root.subtests.length) {
1150-
// This file had no tests in it. Add the placeholder test.
1149+
if (threw || topLevelTestCount === root.subtests.length) {
1150+
// This file failed to load or had no tests in it. Add the placeholder test.
11511151
const subtest = root.createSubtest(Test, testFile, kEmptyObject, undefined, {
11521152
__proto__: null,
11531153
loc: [1, 1, resolve(testFile)],
Collapse file

‎test/fixtures/test-runner/throws-after-test.mjs‎

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { test } from 'node:test';
2+
3+
test('registered before the error', () => {});
4+
null.x;
5+
test('never registered', () => {});
Collapse file

‎test/parallel/test-runner-no-isolation-load-error.js‎

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('node:assert');
4+
const fixtures = require('../common/fixtures');
5+
const { run } = require('node:test');
6+
7+
const testFile = fixtures.path('test-runner', 'throws-after-test.mjs');
8+
const testRun = run({
9+
files: [testFile],
10+
isolation: 'none'
11+
});
12+
13+
testRun.on('test:pass', common.mustCall((test) => {
14+
assert.strictEqual(test.name, 'registered before the error');
15+
}));
16+
17+
testRun.on('test:fail', common.mustCall((test) => {
18+
assert.strictEqual(test.name, testFile);
19+
assert.match(test.details.error.toString(), /TypeError: Cannot read properties of null/);
20+
}));

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.