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 failures in filtered suites · nodejs/node@e70711e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • test.js
  • test
    • fixtures/test-runner/output
      • filtered-suite-throws.js
      • filtered-suite-throws.snapshot
    • parallel
      • test-runner-output.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/test.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,15 +1181,15 @@ class Suite extends Test {
11811181
);
11821182
} catch (err) {
11831183
this.fail(new ERR_TEST_FAILURE(err, kTestCodeFailure));
1184-
1185-
this.buildPhaseFinished = true;
1184+
this.postBuild();
11861185
}
11871186
this.fn = noop;
11881187
}
11891188

11901189
postBuild() {
11911190
this.buildPhaseFinished = true;
1192-
if (this.filtered && this.filteredSubtestCount !== this.subtests.length) {
1191+
if (this.filtered &&
1192+
(this.filteredSubtestCount !== this.subtests.length || this.error)) {
11931193
// A suite can transition from filtered to unfiltered based on the
11941194
// tests that it contains - in case of children matching patterns.
11951195
this.filtered = false;
Collapse file

‎test/fixtures/test-runner/output/filtered-suite-throws.js‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Flags: --test-name-pattern=enabled
2+
'use strict';
3+
const common = require('../../../common');
4+
const { suite, test } = require('node:test');
5+
6+
suite('suite 1', () => {
7+
throw new Error('boom 1');
8+
test('enabled - should not run', common.mustNotCall());
9+
});
10+
11+
suite('suite 2', () => {
12+
test('enabled - should get cancelled', common.mustNotCall());
13+
throw new Error('boom 1');
14+
});
Collapse file

‎test/fixtures/test-runner/output/filtered-suite-throws.snapshot‎

Copy file name to clipboard
+62Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
TAP version 13
2+
# Subtest: suite 1
3+
not ok 1 - suite 1
4+
---
5+
duration_ms: *
6+
type: 'suite'
7+
location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):1'
8+
failureType: 'testCodeFailure'
9+
error: 'boom 1'
10+
code: 'ERR_TEST_FAILURE'
11+
stack: |-
12+
*
13+
*
14+
*
15+
*
16+
*
17+
*
18+
*
19+
*
20+
*
21+
*
22+
...
23+
# Subtest: suite 2
24+
# Subtest: enabled - should get cancelled
25+
not ok 1 - enabled - should get cancelled
26+
---
27+
duration_ms: *
28+
location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):3'
29+
failureType: 'cancelledByParent'
30+
error: 'test did not finish before its parent and was cancelled'
31+
code: 'ERR_TEST_FAILURE'
32+
...
33+
1..1
34+
not ok 2 - suite 2
35+
---
36+
duration_ms: *
37+
type: 'suite'
38+
location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):1'
39+
failureType: 'testCodeFailure'
40+
error: 'boom 1'
41+
code: 'ERR_TEST_FAILURE'
42+
stack: |-
43+
*
44+
*
45+
*
46+
*
47+
*
48+
*
49+
*
50+
*
51+
*
52+
*
53+
...
54+
1..2
55+
# tests 1
56+
# suites 2
57+
# pass 0
58+
# fail 0
59+
# cancelled 1
60+
# skipped 0
61+
# todo 0
62+
# duration_ms *
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-runner-output.mjs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const tests = [
101101
{ name: 'test-runner/output/eval_dot.js', transform: specTransform },
102102
{ name: 'test-runner/output/eval_spec.js', transform: specTransform },
103103
{ name: 'test-runner/output/eval_tap.js' },
104+
{ name: 'test-runner/output/filtered-suite-throws.js' },
104105
{ name: 'test-runner/output/hooks.js' },
105106
{ name: 'test-runner/output/hooks_spec_reporter.js', transform: specTransform },
106107
{ name: 'test-runner/output/skip-each-hooks.js', transform: specTransform },

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.