-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathJUnitResult.js
More file actions
18 lines (17 loc) · 796 Bytes
/
JUnitResult.js
File metadata and controls
18 lines (17 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
exports.parsePerfStats = function parsePerfStats(text) {
var regexp = /<perfstat[\s]+type="([\w\:]+)"[\s]*>([\d]+)/g;
var perfstats = [];
for ( var match = regexp.exec( text ); match !== null; match = regexp.exec( text ) ) {
perfstats.push( { type: match[ 1 ], value: match[ 2 ] } );
}
return perfstats;
}
exports.getResults = function getResults(test) {
// This assumes that the test will still be in raw request form,
// If not we can just skip the test.body and pass the results in straight.
result = test.body.results,
skipCount = result.match( /<skipped/g ),
failCount = result.match( /<failure/g ),
errorCount = result.match( /<error/g );
return {result: result, skipCount: skipCount, failCount: failCount, errorCount: errorCount}
}