tap-junit

Silly small, silly easy junit output formatter for tap.

MIT 35 个版本
安装
npm install tap-junit
yarn add tap-junit
pnpm add tap-junit
bun add tap-junit
README

GitHub Actions Workflow Status npm Downloads

tap-junit

Silly small, silly easy junit output formatter for tap.

Works with tape and other tap based tests just pipe it into tap-junit

Parameters

  • -c, --classname - The name you want to apply to the testsuite element (if not set no name is given to the output testsuite)
  • -o, --output - designate where you want the .xml results to output
    • If you do not specify an output then results will be displayed within the terminal
  • -n, --name - value provided will be the name of the output.xml file, otherwise defaults to tap.xml
  • -s, --suite - sets the main test suite name defaults to Tap-Junit if not passed
  • -v, --version - displays the current tap-junit version
  • -i, --input - Specify a specific tap txt input file to transform
  • -p, --pretty - Specify if you want the output xml to be prettified or not this is false by default

Installation

npm i -D tap-junit

Usage

tape test/*.js | tap-junit --output output/test

node test.js | ./node_modules/tap-junit/bin/tap-junit --output output/test

tap-junit -o output/tests -n nontape < src/test/non-tape.tap

tape tests/thing.js | tap-junit > output/thing.xml

tap-junit -i tap.txt -s suite-name

You can now use custom extensions (in version 3.1.0+) simply add the extension to the end of your file name. If none is provided tap-junit will still default to .xml

tape test/*.js | tap-junit -o output/tests -n tape.xuni

The above will create a file called tape.xuni in the output/tests directory with the results inside.

Output

Tap-Junit currently follows this spec on junit syntax/layout

<testsuites tests="4" name="Tap-Junit" failures="2">
  <testsuite tests="4" failures="2" skipped="1">
    <testcase id="1" name="test is equal"/>
    <testcase id="2" name="test skip extra # SKIP">
      <skipped/>
    </testcase>
    <testcase id="3" name="should not be equal"/>
    <testcase id="4" name="should be equal"/>
  </testsuite>
</testsuites>

Comments

So Tap Junit takes a tape style assumption when it comes to comments. That being, when a comment appears before a test (because that's how tape labels its tap output) it will be registered as a comment for that test, but the issue here is that you may lose placed comments in your tap files.

At the moment, I'm still trying to figure out a decent way to handle comments and record them. Keep this in mind that only a single comment before each test will currently be recorded for a system-out tag.

If you have ideas on how to better handle this, don't hesitate to reach out!

版本列表
5.0.4 2024-10-08
5.0.3 2024-01-27
5.0.2 2022-04-06
5.0.1 2021-07-26
5.0.0 2021-06-03
4.2.0 2021-02-03
4.1.0 2020-12-30
4.0.0 2020-11-24
3.1.2 2020-04-07
3.1.1 2020-04-04
3.1.0 2019-04-15
3.0.2 2019-02-15
3.0.1 2019-01-31
3.0.0 2019-01-31
2.2.0-beta.1 2018-12-13
2.2.0-beta 2018-12-13
2.1.0 2018-09-04
2.0.0 2018-06-29
1.2.11 2018-04-18
1.2.10 2017-12-27
1.2.9 2017-12-20
1.2.8 2017-09-11
1.2.7 2017-09-06
1.2.6 2017-09-06
1.2.5 2017-08-30
1.2.4 2017-07-26
1.2.3 2017-07-26
1.2.2 2017-07-19
1.2.1 2017-07-15
1.2.0 2017-07-09
1.1.0 2017-07-09
1.0.3 2017-05-01
1.0.2 2017-03-24
1.0.1 2017-03-24
1.0.0 2017-03-23