@omarestrella/jest-junit
Advanced tools
Comparing version 12.1.0-beta.1 to 12.1.0-beta.2
44
index.js
@@ -1,10 +0,10 @@ | ||
'use strict'; | ||
"use strict"; | ||
const xml = require('xml'); | ||
const mkdirp = require('mkdirp'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const xml = require("xml"); | ||
const mkdirp = require("mkdirp"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const buildJsonResults = require('./utils/buildJsonResults'); | ||
const getOptions = require('./utils/getOptions'); | ||
const buildJsonResults = require("./utils/buildJsonResults"); | ||
const getOptions = require("./utils/getOptions"); | ||
@@ -24,6 +24,13 @@ // Store console results from onTestResult to later | ||
const jsonResults = buildJsonResults(report, fs.realpathSync(process.cwd()), options); | ||
const jsonResults = buildJsonResults( | ||
report, | ||
fs.realpathSync(process.cwd()), | ||
options | ||
); | ||
// Set output to use new outputDirectory and fallback on original output | ||
const outputName = (options.uniqueOutputName === 'true') ? getOptions.getUniqueOutputName() : options.outputName | ||
const outputName = | ||
options.uniqueOutputName === "true" | ||
? getOptions.getUniqueOutputName() | ||
: options.outputName; | ||
const output = path.join(options.outputDirectory, outputName); | ||
@@ -37,3 +44,6 @@ | ||
// Write data to file | ||
fs.writeFileSync(finalOutput, xml(jsonResults, { indent: ' ', declaration: true })); | ||
fs.writeFileSync( | ||
finalOutput, | ||
xml(jsonResults, { indent: " ", declaration: true }) | ||
); | ||
@@ -60,3 +70,3 @@ // Jest 18 compatibility | ||
// TODO: refactor to es6 class after testResultsProcessor support is removed | ||
function JestJUnit (globalConfig, options) { | ||
function JestJUnit(globalConfig, options) { | ||
// See if constructor was invoked statically | ||
@@ -66,6 +76,10 @@ // which indicates jest-junit was invoked as a testResultsProcessor | ||
if (globalConfig.hasOwnProperty('testResults')) { | ||
const newConfig = JSON.stringify({ | ||
reporters: ['jest-junit'] | ||
}, null, 2); | ||
if (globalConfig.hasOwnProperty("testResults")) { | ||
const newConfig = JSON.stringify( | ||
{ | ||
reporters: ["jest-junit"], | ||
}, | ||
null, | ||
2 | ||
); | ||
@@ -72,0 +86,0 @@ return processor(globalConfig); |
{ | ||
"name": "@omarestrella/jest-junit", | ||
"version": "12.1.0-beta.1", | ||
"version": "12.1.0-beta.2", | ||
"description": "A jest reporter that generates junit xml files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -193,3 +193,3 @@ 'use strict'; | ||
let junitProperties = require(junitSuitePropertiesFilePath)(suite); | ||
testCase.properties = []; | ||
let properties = []; | ||
@@ -211,7 +211,9 @@ let testCaseProperties = {}; | ||
testCase.properties.push(testCaseProperty); | ||
properties.push(testCaseProperty); | ||
}); | ||
if (testCase.properties.length === 0) { | ||
delete testCase.properties; | ||
if (properties.length > 0) { | ||
testCase.testcase.push({ | ||
properties | ||
}) | ||
} | ||
@@ -218,0 +220,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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
35650
417