Skip to content

Commit f70a693

Browse files
committed
test: snapshot junit output for empty diagnostic
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
1 parent a2d5d1c commit f70a693

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

test/fixtures/test-runner/empty-diagnostic.js renamed to test/fixtures/test-runner/output/junit_empty_diagnostic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --test --test-reporter=junit
12
'use strict';
23
const test = require('node:test');
34

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<testsuites>
3+
<testcase name="failing" time="*" classname="test" file="*" failure="error">
4+
<failure type="testCodeFailure" message="error">
5+
[Error [ERR_TEST_FAILURE]: error] {
6+
code: 'ERR_TEST_FAILURE',
7+
failureType: 'testCodeFailure',
8+
cause: Error: error
9+
at TestContext.&lt;anonymous> (<project-root>/test/fixtures/test-runner/output/junit_empty_diagnostic.js:7:9)
10+
at <node-internal-frames>
11+
}
12+
</failure>
13+
</testcase>
14+
<!-- -->
15+
<!-- tests 1 -->
16+
<!-- suites 0 -->
17+
<!-- pass 0 -->
18+
<!-- fail 1 -->
19+
<!-- cancelled 0 -->
20+
<!-- skipped 0 -->
21+
<!-- todo 0 -->
22+
<!-- duration_ms * -->
23+
</testsuites>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Test that the output of test-runner/output/junit_empty_diagnostic.js matches
2+
// test-runner/output/junit_empty_diagnostic.snapshot
3+
import '../common/index.mjs';
4+
import * as fixtures from '../common/fixtures.mjs';
5+
import { spawnAndAssert, junitTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
6+
7+
ensureCwdIsProjectRoot();
8+
await spawnAndAssert(
9+
fixtures.path('test-runner/output/junit_empty_diagnostic.js'),
10+
junitTransform,
11+
);

0 commit comments

Comments
 (0)