@reporters/junit
v1.3.2
Published
A jUnit reporter for `node:test`
Downloads
607
Maintainers
Readme
Junit Reporter
A Junit reporter for node:test
.
intendend for use with major CI tools like Jenkins, CircleCI, etc that consume Junit reports.
Installation
npm install --save-dev @reporters/junit
or
yarn add --dev @reporters/junit
Usage
node --test \
--test-reporter=@reporters/junit --test-reporter-destination=stdout \
--test-reporter=spec --test-reporter-destination=stdout
Example
Ouput of the following test file:
const { describe, it } = require('node:test');
describe('tests', () => {
it('is ok', () => {});
it('fails', () => {
throw new Error('this is an error');
});
});
<testsuite name="tests" time="0.00239" disabled="0" errors="0" tests="2" failures="1" skipped="0" hostname="PC.localdomain">
<testcase name="is ok" time="0.00057" classname="test"></testcase>
<testcase name="fails" time="0.00017" classname="test" failure="this is an error">
<failure message="this is an error" type="testCodeFailure">
[Error [ERR_TEST_FAILURE]: this is an error] {
failureType: 'testCodeFailure',
cause: Error: this is an error
at Object.<anonymous> (/Users/test/reporters/tests/example.js:6:11)
at ItTest.runInAsyncScope (node:async_hooks:204:9)
at ItTest.run (node:internal/test_runner/test:547:25)
at Suite.processPendingSubtests (node:internal/test_runner/test:302:27)
at ItTest.postRun (node:internal/test_runner/test:632:19)
at ItTest.run (node:internal/test_runner/test:575:10)
at async Promise.all (index 0)
at async Suite.run (node:internal/test_runner/test:798:7),
code: 'ERR_TEST_FAILURE'
}
</failure>
</testcase>
</testsuite>
</testsuites>