jest-junit
Advanced tools
Comparing version 6.3.0 to 6.4.0
@@ -16,2 +16,3 @@ 'use strict'; | ||
JEST_JUNIT_ADD_FILE_ATTRIBUTE: 'addFileAttribute', | ||
JEST_JUNIT_INCLUDE_CONSOLE_OUTPUT: 'includeConsoleOutput', | ||
JEST_USE_PATH_FOR_SUITE_NAME: 'usePathForSuiteName', | ||
@@ -30,2 +31,3 @@ }, | ||
addFileAttribute: 'false', | ||
includeConsoleOutput: 'false', | ||
}, | ||
@@ -32,0 +34,0 @@ CLASSNAME_VAR: 'classname', |
{ | ||
"name": "jest-junit", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"description": "A jest reporter that generates junit xml files", | ||
@@ -19,3 +19,3 @@ "main": "index.js", | ||
"test": "jest", | ||
"pretest:ci": "npm install jest@$JEST_VERSION", | ||
"pretest:ci": "npm uninstall jest babel-jest && npm install jest@$JEST_VERSION babel-jest@$JEST_VERSION --no-save", | ||
"test:ci": "jest --ci" | ||
@@ -22,0 +22,0 @@ }, |
@@ -12,3 +12,3 @@ [![Build Status](https://travis-ci.org/jest-community/jest-junit.svg?branch=master)](https://travis-ci.org/jest-community/jest-junit) | ||
## Important Notice | ||
In an upcoming major version 5.x jest-junit will no longer function as a testResultProcessor. It will only work as a jest reporter. See the docs just below this for how to transition your project. | ||
In an upcoming major version 7.x jest-junit will no longer function as a testResultProcessor. It will only work as a jest reporter. See the docs just below this for how to transition your project. | ||
@@ -55,18 +55,19 @@ ## Usage | ||
`jest-junit` offers seven configurations based on environment variables or a `jest-junit` key defined in `package.json` or a reporter option. | ||
`jest-junit` offers several configurations based on environment variables or a `jest-junit` key defined in `package.json` or a reporter option. | ||
Environment variable and package.json configuration should be **strings**. | ||
Reporter options should also be strings exception for suiteNameTemplate, classNameTemplate, titleNameTemplate that can also accept a function returning a string. | ||
| Variable Name | Description | Default | Possible Injection Values | ||
|--|--|--|--| | ||
| `JEST_SUITE_NAME` | `name` attribute of `<testsuites>` | `"jest tests"` | N/A | ||
| `JEST_JUNIT_OUTPUT` | File path to save the output. | `"./junit.xml"` | N/A | ||
| `JEST_JUNIT_OUTPUT_DIR` | Directory to save the output. | `null` | N/A | ||
| `JEST_JUNIT_OUTPUT_NAME` | File name for the output. | `"./junit.xml"` | N/A | ||
| `JEST_JUNIT_SUITE_NAME` | Template string for `name` attribute of the `<testsuite>`. | `"{title}"` | `{title}`, `{filepath}`, `{filename}`, `{displayName}` | ||
| `JEST_JUNIT_CLASSNAME` | Template string for the `classname` attribute of `<testcase>`. | `"{classname} {title}"` | `{classname}`, `{title}`, `{filepath}`, `{filename}`, `{displayName}` | ||
| `JEST_JUNIT_TITLE` | Template string for the `name` attribute of `<testcase>`. | `"{classname} {title}"` | `{classname}`, `{title}`, `{filepath}`, `{filename}`, `{displayName}` | ||
| `JEST_JUNIT_ANCESTOR_SEPARATOR` | Character(s) used to join the `describe` blocks. | `" "` | N/A | ||
| `JEST_JUNIT_ADD_FILE_ATTRIBUTE` | 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. | `false` | N/A | ||
| `JEST_USE_PATH_FOR_SUITE_NAME` | **DEPRECATED. Use `suiteNameTemplate` instead.** Use file path as the `name` attribute of `<testsuite>` | `"false"` | N/A | ||
| 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_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}` | ||
| `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. | `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_USE_PATH_FOR_SUITE_NAME` | `usePathForSuiteName` | **DEPRECATED. Use `suiteNameTemplate` instead.** Use file path as the `name` attribute of `<testsuite>` | `"false"` | N/A | ||
@@ -73,0 +74,0 @@ |
@@ -104,2 +104,16 @@ 'use strict'; | ||
// Write stdout console output if available | ||
if (options.includeConsoleOutput === 'true' && suite.console && suite.console.length) { | ||
// Stringify the entire console object | ||
// Easier this way because formatting in a readable way is tough with XML | ||
// And this can be parsed more easily | ||
let testSuiteConsole = { | ||
'system-out': { | ||
_cdata: JSON.stringify(suite.console, null, 2) | ||
} | ||
}; | ||
testSuite.testsuite.push(testSuiteConsole); | ||
} | ||
// Iterate through test cases | ||
@@ -157,2 +171,2 @@ suite.testResults.forEach((tc) => { | ||
return jsonResults; | ||
}; | ||
}; |
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
30384
292
221