Comparing version 2.1.0 to 2.1.1
@@ -15,3 +15,3 @@ import './polyfills'; | ||
runAllExecutableTestSuites(options?: Loadmill.TestSuiteOptions | undefined, params?: Loadmill.Params | undefined, testArgs?: Loadmill.Args | undefined): Promise<Loadmill.TestResult[]>; | ||
junitReport(suite: Loadmill.TestResult, path?: string | undefined): void; | ||
junitReport(suite: Loadmill.TestResult | Loadmill.TestResult[], path?: string | undefined): void; | ||
}; | ||
@@ -18,0 +18,0 @@ declare namespace Loadmill { |
@@ -128,5 +128,6 @@ "use strict"; | ||
}; | ||
var generateJunitJsonReport = function (suite) { | ||
var _a = suite.flowRuns, flowRuns = _a === void 0 ? [] : _a; | ||
var failures = flowRuns.filter(function (f) { return f.status !== 'PASSED'; }).length; | ||
var generateJunitJsonReport = function (suiteOrSuites) { | ||
if (!Array.isArray(suiteOrSuites)) { | ||
suiteOrSuites = [suiteOrSuites]; | ||
} | ||
var flowResult = function (f) { | ||
@@ -142,20 +143,24 @@ return { | ||
}; | ||
var suiteResult = function (suite) { | ||
var _a = suite.flowRuns, flowRuns = _a === void 0 ? [] : _a; | ||
var failures = flowRuns.filter(function (f) { return f.status !== 'PASSED'; }).length; | ||
return { | ||
'testsuite': [{ | ||
_attr: { | ||
name: suite.description, | ||
errors: failures, | ||
failures: failures, | ||
timestamp: (new Date()).toISOString().slice(0, -5), | ||
tests: flowRuns.length, | ||
url: suite.url | ||
} | ||
}].concat(flowRuns.map(flowResult)) | ||
}; | ||
}; | ||
var jsonResults = { | ||
'testsuites': [{ | ||
_attr: { | ||
name: 'Loadmill suites run', | ||
url: suite.url | ||
name: 'Loadmill suites run' | ||
} | ||
}, | ||
{ | ||
'testsuite': [{ | ||
_attr: { | ||
name: suite.description, | ||
errors: failures, | ||
failures: failures, | ||
timestamp: (new Date()).toISOString().slice(0, -5), | ||
tests: flowRuns.length | ||
} | ||
}].concat(flowRuns.map(flowResult)) | ||
}] | ||
}].concat(suiteOrSuites.map(suiteResult)) | ||
}; | ||
@@ -162,0 +167,0 @@ return jsonResults; |
{ | ||
"name": "loadmill", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -226,3 +226,3 @@ import './polyfills' | ||
function _junitReport(suite: Loadmill.TestResult, path?: string){ | ||
function _junitReport(suite: Loadmill.TestResult | Array<Loadmill.TestResult>, path?: string){ | ||
return createJunitReport(suite, path); | ||
@@ -321,3 +321,3 @@ } | ||
junitReport(suite: Loadmill.TestResult, path?: string): void { | ||
junitReport(suite: Loadmill.TestResult| Array<Loadmill.TestResult>, path?: string): void { | ||
return _junitReport(suite, path); | ||
@@ -324,0 +324,0 @@ }, |
@@ -148,5 +148,7 @@ import * as fs from "fs"; | ||
const generateJunitJsonReport = (suite: Loadmill.TestResult) => { | ||
const { flowRuns = [] } = suite; | ||
const failures = flowRuns.filter((f: any) => f.status !== 'PASSED').length; | ||
const generateJunitJsonReport = (suiteOrSuites: Loadmill.TestResult | Array<Loadmill.TestResult>) => { | ||
if (!Array.isArray(suiteOrSuites)) { | ||
suiteOrSuites = [suiteOrSuites]; | ||
} | ||
@@ -164,10 +166,7 @@ const flowResult = (f) => { | ||
let jsonResults = { | ||
'testsuites': [{ | ||
_attr: { | ||
name: 'Loadmill suites run', | ||
url: suite.url | ||
} | ||
}, | ||
{ | ||
const suiteResult = (suite) => { | ||
const { flowRuns = [] } = suite; | ||
const failures = flowRuns.filter((f: any) => f.status !== 'PASSED').length; | ||
return { | ||
'testsuite': [{ | ||
@@ -179,3 +178,4 @@ _attr: { | ||
timestamp: (new Date()).toISOString().slice(0, -5), | ||
tests: flowRuns.length | ||
tests: flowRuns.length, | ||
url: suite.url | ||
} | ||
@@ -185,3 +185,12 @@ }, | ||
] | ||
}] | ||
}; | ||
} | ||
let jsonResults = { | ||
'testsuites': [{ | ||
_attr: { | ||
name: 'Loadmill suites run', | ||
} | ||
}, | ||
...suiteOrSuites.map(suiteResult)] | ||
}; | ||
@@ -192,3 +201,3 @@ | ||
const generateJunitXmlReport = (suite: Loadmill.TestResult) => { | ||
const generateJunitXmlReport = (suite: Loadmill.TestResult | Array<Loadmill.TestResult>) => { | ||
const jsonResults = generateJunitJsonReport(suite); | ||
@@ -198,3 +207,3 @@ return xml(jsonResults, { indent: ' ', declaration: true }); | ||
export const junitReport = (suite: Loadmill.TestResult, path?: string) => { | ||
export const junitReport = (suite: Loadmill.TestResult | Array<Loadmill.TestResult>, path?: string) => { | ||
if (!suite) { | ||
@@ -201,0 +210,0 @@ return; |
Sorry, the diff of this file is not supported yet
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
108008
18
1923