| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9a7700d commit eb8b193
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ function isFailure(node) { | |||
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | 60 | 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; | ||
| 62 | 62 | } | |
| 63 | 63 | ||
| 64 | 64 | module.exports = async function* junitReporter(source) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -191,4 +191,17 @@ describe('node:test reporters', { concurrency: true }, () => { | |||
| 191 | 191 | assert.match(fileConent, /ℹ skipped 0/); | |
| 192 | 192 | assert.match(fileConent, /ℹ todo 0/); | |
| 193 | 193 | }); | |
| 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 | + }); | ||
| 194 | 207 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments