Silly small and silly easy XML tap output formatter.
Works with tape and other tap based tests just pipe it into tap-junit and set your output param.
If no output is set, then the output will now write to the console instead of creating a basic file
NOTE v1.2.0+ is using Stream3 if you wish to stay on stream2 stick to versions 1.1.0 or lower
You can checkout the changelog at: https://github.com/dhershman1/tap-junit/blob/master/changelog.md
-o, --output
- designate where you want the .xml results to output-n, --name
- value provided will be the name of theoutput.xml
file, otherwise defaults totap.xml
npm install -g tap-junit
npm install tap-junit --save-dev
tape test/*.js | tap-junit --output output/test
node test.js | ./node_modules/tap-junit/bin/tap-junit --output output/test
Using the API is rather simple since it really only has 1 purpose
const tapJunit = require('tap-junit');
tapJunit.setOutput('./');
// If using a plugin like karma-tap-pretty-reporter your tapReporter option would look like:
tapReporter: {
prettify: tapJunit.main
},
<testsuites>
<testsuite skipped="false" tests="3" failures="0" errors="0" name="example tests">
<testcase name="#1 Results should return val"/>
<testcase name="#2 results should return newVal"/>
<testcase name="#3 should not change param should return sameVal"/>
</testsuite>
</testsuites>
tap-junit
uses regex currently to determine skipped tests it looks for the # SKIP
string strictly, so please avoid using this in your test/assert name/msg or you may get incorrect outputs. This is done because none of the current Parsers have solid support for TODO
or SKIP
in tap.
If it is requested I will go back to just having the output write blank testsuites and not writing asserts at all when a value is skipped (due to the feedback from tap itself)
Skipped asserts will show up like so:
<testcase name="#1 test skip extra # SKIP">
<skipped/>
</testcase>
And Fully skipped tests will show up like so:
<testsuite skipped="true" tests="0" failures="0" errors="0" name="SKIP skipped test"/>