jest-junit
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -11,2 +11,3 @@ 'use strict'; | ||
JEST_JUNIT_TITLE: 'titleTemplate', | ||
JEST_JUNIT_ANCESTOR_SEPARATOR: 'ancestorSeparator', | ||
JEST_USE_PATH_FOR_SUITE_NAME: 'usePathForSuiteName', | ||
@@ -19,2 +20,3 @@ }, | ||
titleTemplate: '{classname} {title}', | ||
ancestorSeparator: ' ', | ||
usePathForSuiteName: 'false', | ||
@@ -21,0 +23,0 @@ }, |
{ | ||
"name": "jest-junit", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A jest result processor that generates junit xml files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,11 +27,12 @@ [![Build Status](https://travis-ci.org/palmerj3/jest-junit.svg?branch=master)](https://travis-ci.org/palmerj3/jest-junit) | ||
`jest-junit` offers five configurations based on environment variables. All are **string** values | ||
`jest-junit` offers five configurations based on environment variables or a `jest-junit` key defined in `package.json`. All configuration values should be **strings**. | ||
| Variable Name | Default | | ||
|--|--| | ||
| `JEST_SUITE_NAME` | `"jest tests"` | | ||
| `JEST_JUNIT_OUTPUT` | `"./junit.xml"` | | ||
| `JEST_JUNIT_CLASSNAME` | `"{classname} {title}"` | | ||
| `JEST_JUNIT_TITLE` | `"{classname} {title}"` | | ||
| `JEST_USE_PATH_FOR_SUITE_NAME` | `"false"` | | ||
| Variable Name | Description | Default | | ||
|--|--|--| | ||
| `JEST_SUITE_NAME` | `name` attribute of `<testsuites>` | `"jest tests"` | | ||
| `JEST_JUNIT_OUTPUT` | File path to save the output. | `"./junit.xml"` | | ||
| `JEST_JUNIT_CLASSNAME` | Template string for the `classname` attribute of `<testcase>`. | `"{classname} {title}"` | | ||
| `JEST_JUNIT_TITLE` | Template string for the `name` attribute of `<testcase>`. | `"{classname} {title}"` | | ||
| `JEST_JUNIT_ANCESTOR_SEPARATOR` | Character(s) used to join the `describe` blocks. | `" "` | | ||
| `JEST_USE_PATH_FOR_SUITE_NAME` | Use file path as the `name` attribute of `<testsuite>` | `"false"` | | ||
@@ -48,18 +49,32 @@ Example: | ||
{ | ||
... | ||
"jest-junit": { | ||
"suiteName": "jest tests", | ||
"output": "./junit.xml", | ||
"classNameTemplate": "{classname}-{title}", | ||
"titleTemplate": "{classname}-{title}", | ||
"usePathForSuiteName": "true" | ||
} | ||
... | ||
"jest-junit": { | ||
"suiteName": "jest tests", | ||
"output": "./junit.xml", | ||
"classNameTemplate": "{classname}-{title}", | ||
"titleTemplate": "{classname}-{title}", | ||
"ancestorSeparator": " › ", | ||
"usePathForSuiteName": "true" | ||
} | ||
} | ||
``` | ||
Example output: | ||
For the following test: | ||
```js | ||
describe('addition', () => { | ||
describe('positive numbers', () => { | ||
it('should add up', () => { | ||
expect(1 + 2).toBe(3); | ||
}); | ||
}); | ||
}); | ||
``` | ||
The default output: | ||
```xml | ||
<testsuites name="Jest JUnit Unit Tests"> | ||
<testsuite name="My first suite" tests="1" errors="0" failures="0" skipped="0" timestamp="2016-11-19T01:37:20" time="0.105"> | ||
<testcase classname="My test case" name="My test case" time="6"> | ||
<testsuites name="jest tests"> | ||
<testsuite name="addition" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-07-13T09:42:28" time="0.161"> | ||
<testcase classname="addition positive numbers should add up" name="addition positive numbers should add up" time="0.004"> | ||
</testcase> | ||
@@ -70,3 +85,3 @@ </testsuite> | ||
Changing the title and classname | ||
Changing the `classNameTemplate` and `titleTemplate`: | ||
@@ -79,4 +94,4 @@ ```shell | ||
<testsuites name="jest tests"> | ||
<testsuite name="foo" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-02-19T22:36:15" time="0.232"> | ||
<testcase classname="foo" name="bar" time="0.003"> | ||
<testsuite name="addition" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-07-13T09:45:42" time="0.154"> | ||
<testcase classname="addition positive numbers" name="should add up" time="0.005"> | ||
</testcase> | ||
@@ -86,1 +101,16 @@ </testsuite> | ||
``` | ||
Changing just the `ancestorSeparator`: | ||
```shell | ||
JEST_JUNIT_ANCESTOR_SEPARATOR=" › " jest | ||
``` | ||
```xml | ||
<testsuites name="jest tests"> | ||
<testsuite name="addition" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-07-13T09:47:12" time="0.162"> | ||
<testcase classname="addition › positive numbers should add up" name="addition › positive numbers should add up" time="0.004"> | ||
</testcase> | ||
</testsuite> | ||
</testsuites> | ||
``` |
@@ -50,3 +50,3 @@ 'use strict'; | ||
suite.testResults.forEach((tc) => { | ||
const classname = tc.ancestorTitles.join(' '); | ||
const classname = tc.ancestorTitles.join(options.ancestorSeparator); | ||
const title = tc.title; | ||
@@ -53,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19909
146
112