From fe4872002d38249097d1216f64e484d90ef090cc Mon Sep 17 00:00:00 2001 From: miguelangarano Date: Wed, 20 Nov 2024 13:08:25 -0500 Subject: [PATCH] fix: remove logs, update parsing --- cy-example/combined-results.xml | 12 ++--- ...sults-9b3c9e70a3ea29bded50339819b55a4d.xml | 11 +++++ ...sults-cd26ab75fb7fa3716e4f782fc2925e78.xml | 13 +++++ scripts/junitXmlToInstanceJson.js | 20 ++++---- vitest-example/junit.xml | 30 ++++++++---- wdio-example/results-1732121752524-0-0.xml | 48 +++++++++++++++++++ wdio-example/results-1732121752524-0-1.xml | 29 +++++++++++ 7 files changed, 139 insertions(+), 24 deletions(-) create mode 100644 cy-example/results-9b3c9e70a3ea29bded50339819b55a4d.xml create mode 100644 cy-example/results-cd26ab75fb7fa3716e4f782fc2925e78.xml create mode 100644 wdio-example/results-1732121752524-0-0.xml create mode 100644 wdio-example/results-1732121752524-0-1.xml diff --git a/cy-example/combined-results.xml b/cy-example/combined-results.xml index 6848150..255d508 100644 --- a/cy-example/combined-results.xml +++ b/cy-example/combined-results.xml @@ -1,14 +1,14 @@ - + + + + + AssertionError: Timed out retrying after 4000ms: expected 'Google' to include 'Amazon' at Context.eval (webpack:///./e2e/first.cy.js:4:15) - - - - - + \ No newline at end of file diff --git a/cy-example/results-9b3c9e70a3ea29bded50339819b55a4d.xml b/cy-example/results-9b3c9e70a3ea29bded50339819b55a4d.xml new file mode 100644 index 0000000..c30f95b --- /dev/null +++ b/cy-example/results-9b3c9e70a3ea29bded50339819b55a4d.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/cy-example/results-cd26ab75fb7fa3716e4f782fc2925e78.xml b/cy-example/results-cd26ab75fb7fa3716e4f782fc2925e78.xml new file mode 100644 index 0000000..4265dff --- /dev/null +++ b/cy-example/results-cd26ab75fb7fa3716e4f782fc2925e78.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/junitXmlToInstanceJson.js b/scripts/junitXmlToInstanceJson.js index 8611a42..0e232b6 100644 --- a/scripts/junitXmlToInstanceJson.js +++ b/scripts/junitXmlToInstanceJson.js @@ -84,7 +84,7 @@ fs.readFile(xmlFilePath, "utf-8", (err, data) => { const suiteJson = { groupId: result.testsuites.name, - spec: suite.file ?? suite.name, + spec: suite.name, worker: { workerIndex: 1, parallelIndex: 1, @@ -104,9 +104,7 @@ fs.readFile(xmlFilePath, "utf-8", (err, data) => { wallClockDuration: durationMillis, }, tests: testcases.map((test) => { - console.log("FAIL::", test.failure); const hasFailure = test?.failure && test?.failure !== "false"; - console.log("FAILURERES::", extractFailure(test?.failure)); return { _t: Date.now(), testId: generateTestId(test?.name, suite.name), @@ -131,20 +129,24 @@ fs.readFile(xmlFilePath, "utf-8", (err, data) => { steps: [], duration: secondsToMilliseconds(parseFloat(test?.time)), status: hasFailure ? "failed" : "passed", - stdout: test?.["system-out"] ? [test?.["system-out"]] : [], - stderr: hasFailure ? extractFailure(test?.failure) : [], + stdout: test?.["system-out"] + ? [test?.["system-out"]] + : undefined, + stderr: hasFailure + ? extractFailure(test?.failure) + : undefined, errors: hasFailure ? [ mergeFailuresIntoMessage( extractFailure(test?.failure) ) ?? {}, ] - : [], + : undefined, error: hasFailure ? mergeFailuresIntoMessage( extractFailure(test?.failure) ) ?? {} - : {}, + : undefined, }, ], }; @@ -176,7 +178,6 @@ function extractFailure(failure) { failureArray.push(failure?._); } if (Array.isArray(failure)) { - console.log("ENTER::"); let failureItem; for (let i = 0; i < failure.length; i++) { if (typeof failure[i] === "object" && failure[i] !== null) { @@ -184,7 +185,6 @@ function extractFailure(failure) { break; } } - console.log("FAIL ITEM::", failureItem); return extractFailure(failureItem); } return failureArray; @@ -203,5 +203,5 @@ function mergeFailuresIntoMessage(failuresArray) { } function secondsToMilliseconds(seconds) { - return Math.round(seconds * 1000); + return seconds * 1000; } diff --git a/vitest-example/junit.xml b/vitest-example/junit.xml index 6617f2a..7ede741 100644 --- a/vitest-example/junit.xml +++ b/vitest-example/junit.xml @@ -1,15 +1,29 @@ - - - + + + - + - + - + - + + + + + + + + + + + + + + + AssertionError: expected 'Hello World' to be 'Hello World!' // Object.is equality @@ -19,7 +33,7 @@ Received: "Hello World" ❯ vitest-example/tests/stringUtils.spec.js:22:44 - + TypeError: str.split is not a function ❯ Module.capitalizeWords vitest-example/stringUtils.js:4:6 diff --git a/wdio-example/results-1732121752524-0-0.xml b/wdio-example/results-1732121752524-0-0.xml new file mode 100644 index 0000000..5e5eb1f --- /dev/null +++ b/wdio-example/results-1732121752524-0-0.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + (/Users/miguelangarano/Documents/GitHub/generic-api-example/wdio-example/tests/signup.e2e.js:11:41) +]]> + + + \ No newline at end of file diff --git a/wdio-example/results-1732121752524-0-1.xml b/wdio-example/results-1732121752524-0-1.xml new file mode 100644 index 0000000..e9cf3fe --- /dev/null +++ b/wdio-example/results-1732121752524-0-1.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file