Skip to content

Commit

Permalink
fix: parse to milliseconds
Browse files Browse the repository at this point in the history
miguelangarano committed Nov 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 46e36b4 commit 25a2fec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/junitXmlToInstanceJson.js
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ fs.readFile(xmlFilePath, "utf-8", (err, data) => {

testsuites.forEach((suite) => {
const startTime = new Date(suite.timestamp);
const durationMillis = parseFloat(suite.time) * 1000;
const durationMillis = secondsToMilliseconds(parseFloat(suite.time));
const endTime = new Date(startTime.getTime() + durationMillis);

const testcases = Array.isArray(suite.testcase)
@@ -129,7 +129,7 @@ fs.readFile(xmlFilePath, "utf-8", (err, data) => {
parallelIndex: 1,
startTime: suite.timestamp,
steps: [],
duration: parseFloat(test?.time) * 1000,
duration: secondsToMilliseconds(parseFloat(test?.time)),
status: hasFailure ? "failed" : "passed",
stdout: test?.["system-out"] ? [test?.["system-out"]] : [],
stderr: hasFailure ? extractFailure(test?.failure) : [],
@@ -201,3 +201,7 @@ function mergeFailuresIntoMessage(failuresArray) {
message: failuresArray.join(", "),
};
}

function secondsToMilliseconds(seconds) {
return Math.round(seconds * 1000);
}

0 comments on commit 25a2fec

Please sign in to comment.