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: fix isSkipped check in junit · nodejs/node@eb8b193

File tree

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

‎lib/internal/test_runner/reporter/junit.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/junit.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function isFailure(node) {
5858
}
5959

6060
function isSkipped(node) {
61-
return (node?.children && ArrayPrototypeSome(node.children, (c) => c.tag === 'skipped')) || node?.attrs?.failures;
61+
return (node?.children && ArrayPrototypeSome(node.children, (c) => c.tag === 'skipped')) || node?.attrs?.skipped;
6262
}
6363

6464
module.exports = async function* junitReporter(source) {
Collapse file

‎test/parallel/test-runner-reporters.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-reporters.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,17 @@ describe('node:test reporters', { concurrency: true }, () => {
191191
assert.match(fileConent, /ℹ skipped 0/);
192192
assert.match(fileConent, /ℹ todo 0/);
193193
});
194+
195+
it('should correctly report pass/fail for junit reporter using reporters.js', async () => {
196+
const file = tmpdir.resolve(`${tmpFiles++}.xml`);
197+
const child = spawnSync(process.execPath,
198+
['--test', '--test-reporter', 'junit', '--test-reporter-destination', file, testFile]);
199+
assert.strictEqual(child.stderr.toString(), '');
200+
assert.strictEqual(child.stdout.toString(), '');
201+
const fileContents = fs.readFileSync(file, 'utf8');
202+
assert.match(fileContents, /<testsuite .*name="nested".*tests="2".*failures="1".*skipped="0".*>/);
203+
assert.match(fileContents, /<testcase .*name="failing".*>\s*<failure .*type="testCodeFailure".*message="error".*>/);
204+
assert.match(fileContents, /<testcase .*name="ok".*classname="test".*\/>/);
205+
assert.match(fileContents, /<testcase .*name="top level".*classname="test".*\/>/);
206+
});
194207
});

0 commit comments

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