Skip to content

Commit

Permalink
Merge pull request #101 from alde/master
Browse files Browse the repository at this point in the history
[feat] Remove support for old 'output' setting
  • Loading branch information
palmerj3 authored Aug 26, 2019
2 parents 2414c98 + 3e13581 commit 43a8de6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ Reporter options should also be strings exception for suiteNameTemplate, classNa
| Environment Variable Name | Reporter Config Name| Description | Default | Possible Injection Values
|--|--|--|--|--|
| `JEST_SUITE_NAME` | `suiteName` | `name` attribute of `<testsuites>` | `"jest tests"` | N/A
| `JEST_JUNIT_OUTPUT` | `output` | File path to save the output. | `"./junit.xml"` | N/A
| `JEST_JUNIT_OUTPUT_DIR` | `outputDirectory` | Directory to save the output. | `null` | N/A
| `JEST_JUNIT_OUTPUT_NAME` | `outputName` | File name for the output. | `"./junit.xml"` | N/A
| `JEST_JUNIT_OUTPUT_DIR` | `outputDirectory` | Directory to save the output. | `process.cwd()` | N/A
| `JEST_JUNIT_OUTPUT_NAME` | `outputName` | File name for the output. | `"junit.xml"` | N/A
| `JEST_JUNIT_SUITE_NAME` | `suiteNameTemplate` | Template string for `name` attribute of the `<testsuite>`. | `"{title}"` | `{title}`, `{filepath}`, `{filename}`, `{displayName}`
| `JEST_JUNIT_CLASSNAME` | `classNameTemplate` | Template string for the `classname` attribute of `<testcase>`. | `"{classname} {title}"` | `{classname}`, `{title}`, `{filepath}`, `{filename}`, `{displayName}`
| `JEST_JUNIT_TITLE` | `titleTemplate` | Template string for the `name` attribute of `<testcase>`. | `"{classname} {title}"` | `{classname}`, `{title}`, `{filepath}`, `{filename}`, `{displayName}`
Expand All @@ -73,7 +72,7 @@ Reporter options should also be strings exception for suiteNameTemplate, classNa
You can configure these options via the command line as seen below:

```shell
JEST_SUITE_NAME="Jest JUnit Unit Tests" JEST_JUNIT_OUTPUT="./artifacts/junit.xml" jest
JEST_SUITE_NAME="Jest JUnit Unit Tests" JEST_JUNIT_OUTPUT_DIR="./artifacts" jest
```

Or you can also define a `jest-junit` key in your `package.json`. All are **string** values.
Expand All @@ -84,7 +83,7 @@ Or you can also define a `jest-junit` key in your `package.json`. All are **str
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": ".",
"outputName": "./junit.xml",
"outputName": "junit.xml",
"classNameTemplate": "{classname}-{title}",
"titleTemplate": "{classname}-{title}",
"ancestorSeparator": " › ",
Expand Down
4 changes: 1 addition & 3 deletions constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const path = require('path');
module.exports = {
ENVIRONMENT_CONFIG_MAP: {
JEST_SUITE_NAME: 'suiteName',
JEST_JUNIT_OUTPUT: 'output',
JEST_JUNIT_OUTPUT_DIR: 'outputDirectory',
JEST_JUNIT_OUTPUT_NAME: 'outputName',
JEST_JUNIT_CLASSNAME: 'classNameTemplate',
Expand All @@ -18,8 +17,7 @@ module.exports = {
},
DEFAULT_OPTIONS: {
suiteName: 'jest tests',
output: path.join(process.cwd(), './junit.xml'),
outputDirectory: null,
outputDirectory: process.cwd(),
outputName: 'junit.xml',
classNameTemplate: '{classname} {title}',
suiteNameTemplate: '{title}',
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const processor = (report, reporterOptions = {}, jestRootDir = null) => {
const jsonResults = buildJsonResults(report, fs.realpathSync(process.cwd()), options);

// Set output to use new outputDirectory and fallback on original output
const output = options.outputDirectory === null ? options.output : path.join(options.outputDirectory, options.outputName);
const output = path.join(options.outputDirectory, options.outputName);

const finalOutput = getOptions.replaceRootDirInOutput(jestRootDir, output);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-junit",
"version": "7.0.0",
"version": "8.0.0",
"description": "A jest reporter that generates junit xml files",
"main": "index.js",
"repository": "https://github.com/jest-community/jest-junit",
Expand Down

0 comments on commit 43a8de6

Please sign in to comment.