Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dhershman1/tap-junit
A silly simple, silly small XML output for tap/tape tests to convert them to junit
https://github.com/dhershman1/tap-junit
junit tap tap-junit testing xml
Last synced: 6 days ago
JSON representation
A silly simple, silly small XML output for tap/tape tests to convert them to junit
- Host: GitHub
- URL: https://github.com/dhershman1/tap-junit
- Owner: dhershman1
- License: mit
- Created: 2017-05-01T15:58:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T01:25:55.000Z (3 months ago)
- Last Synced: 2024-12-23T03:06:39.615Z (13 days ago)
- Topics: junit, tap, tap-junit, testing, xml
- Language: JavaScript
- Homepage:
- Size: 271 KB
- Stars: 16
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/dhershman1/tap-junit/tap-junit.yml?style=flat-square)
[![npm](https://img.shields.io/npm/v/tap-junit.svg?style=flat-square)](https://www.npmjs.com/package/tap-junit)
[![Downloads](https://img.shields.io/npm/dm/tap-junit.svg?style=flat-square)](https://www.npmjs.com/package/tap-junit)# tap-junit
Silly small, silly easy junit output formatter for tap.
Works with [tape](https://github.com/substack/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/testnode 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](https://github.com/junit-team/junit5/blob/main/platform-tests/src/test/resources/jenkins-junit.xsd) on junit syntax/layout
```xml
```
## 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!