jest-junit
Advanced tools
Comparing version 13.0.0 to 13.1.0
@@ -20,3 +20,4 @@ 'use strict'; | ||
JEST_USE_PATH_FOR_SUITE_NAME: 'usePathForSuiteName', | ||
JEST_JUNIT_TEST_SUITE_PROPERTIES_JSON_FILE: 'testSuitePropertiesFile' | ||
JEST_JUNIT_TEST_SUITE_PROPERTIES_JSON_FILE: 'testSuitePropertiesFile', | ||
JEST_JUNIT_TEST_SUITE_PROPERTIES_DIR: 'testSuitePropertiesDirectory', | ||
}, | ||
@@ -38,3 +39,4 @@ DEFAULT_OPTIONS: { | ||
noStackTrace: 'false', | ||
testSuitePropertiesFile: 'junitProperties.js' | ||
testSuitePropertiesFile: 'junitProperties.js', | ||
testSuitePropertiesDirectory: process.cwd(), | ||
}, | ||
@@ -41,0 +43,0 @@ SUITENAME_VAR: 'suitename', |
@@ -25,3 +25,8 @@ 'use strict'; | ||
const jsonResults = buildJsonResults(report, fs.realpathSync(process.cwd()), options); | ||
const jsonResults = buildJsonResults( | ||
report, | ||
fs.realpathSync(process.cwd()), | ||
options, | ||
jestRootDir | ||
); | ||
@@ -28,0 +33,0 @@ let outputPath = getOutputPath(options, jestRootDir); |
{ | ||
"name": "jest-junit", | ||
"version": "13.0.0", | ||
"version": "13.1.0", | ||
"description": "A jest reporter that generates junit xml files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,4 +32,7 @@ [![Actions Status](https://github.com/jest-community/jest-junit/actions/workflows/nodejs.yml/badge.svg?branch=master)](https://github.com/jest-community/jest-junit/actions) | ||
## Usage as testResultsProcessor | ||
In your jest config add the following entry: | ||
## Usage as testResultsProcessor (deprecated) | ||
The support for `testResultsProcessor` is only kept for [legacy reasons][test-results-processor] and might be removed in the future. | ||
You should therefore prefer to configure `jest-junit` as a _reporter_. | ||
Should you still want to, add the following entry to your jest config: | ||
```JSON | ||
@@ -69,8 +72,10 @@ { | ||
| `JEST_JUNIT_ANCESTOR_SEPARATOR` | `ancestorSeparator` | Character(s) used to join the `describe` blocks. | `" "` | N/A | ||
| `JEST_JUNIT_ADD_FILE_ATTRIBUTE` | `addFileAttribute` | Add file attribute to the output. This config is primarily for Circle CI. This setting provides richer details but may break on other CI platforms. Must be a string. | `"false"` | N/A | ||
| `JEST_JUNIT_ADD_FILE_ATTRIBUTE` | `addFileAttribute` | Add file attribute to the output (validated on CIRCLE CI and GitLab CI). Must be a string. | `"false"` | N/A | ||
| `JEST_JUNIT_INCLUDE_CONSOLE_OUTPUT` | `includeConsoleOutput` | Adds console output to any testSuite that generates stdout during a test run. | `false` | N/A | ||
| `JEST_JUNIT_INCLUDE_SHORT_CONSOLE_OUTPUT` | `includeShortConsoleOutput` | Adds short console output (only message value) to any testSuite that generates stdout during a test run. | `false` | N/A | ||
| `JEST_JUNIT_REPORT_TEST_SUITE_ERRORS` | `reportTestSuiteErrors` | Reports test suites that failed to execute altogether as `error`. _Note:_ since the suite name cannot be determined from files that fail to load, it will default to file path.| `false` | N/A | ||
| `JEST_JUNIT_NO_STACK_TRACE` | `noStackTrace` | Omit stack traces from test failure reports, similar to `jest --noStackTrace` | `false` | N/A | ||
| `JEST_JUNIT_NO_STACK_TRACE` | `noStackTrace` | Omit stack traces from test failure reports, similar to `jest --noStackTrace` | `false` | N/A | ||
| `JEST_USE_PATH_FOR_SUITE_NAME` | `usePathForSuiteName` | **DEPRECATED. Use `suiteNameTemplate` instead.** Use file path as the `name` attribute of `<testsuite>` | `"false"` | N/A | ||
| `JEST_JUNIT_TEST_SUITE_PROPERTIES_JSON_FILE` | `testSuitePropertiesFile` | Name of the custom testsuite properties file | `"junitProperties.js"` | N/A | ||
| `JEST_JUNIT_TEST_SUITE_PROPERTIES_DIR` | `testSuitePropertiesDirectory` | Location of the custom testsuite properties file | `process.cwd()` | N/A | ||
@@ -252,1 +257,3 @@ | ||
``` | ||
[test-results-processor]: https://github.com/jest-community/jest-junit/discussions/158#discussioncomment-392985 |
@@ -7,2 +7,3 @@ 'use strict'; | ||
const fs = require('fs'); | ||
const getTestSuitePropertiesPath = require('./getTestSuitePropertiesPath'); | ||
@@ -50,5 +51,8 @@ // Wrap the varName with template tags | ||
module.exports = function (report, appDirectory, options) { | ||
module.exports = function (report, appDirectory, options, rootDir = null) { | ||
// Check if there is a junitProperties.js (or whatever they called it) | ||
const junitSuitePropertiesFilePath = path.join(process.cwd(), options.testSuitePropertiesFile); | ||
const junitSuitePropertiesFilePath = getTestSuitePropertiesPath( | ||
options, | ||
rootDir, | ||
); | ||
let ignoreSuitePropertiesCheck = !fs.existsSync(junitSuitePropertiesFilePath); | ||
@@ -55,0 +59,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
36919
10
417
257