Skip to content

Commit

Permalink
Refactor test suite iteration to use for-of loop and improve test cas…
Browse files Browse the repository at this point in the history
…e failure detection
  • Loading branch information
DE7924 committed Dec 23, 2024
1 parent 0960def commit b6f9c83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
11 changes: 4 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/scripts/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ export const testing = async (
"<table><tr><th>File</th><th>Test Name</th><th>Line</th><th>Type</th><th>Message</th></tr>";

const testSuites = jsonResults["elements"][0]["elements"];
for (let i = 0; i < testSuites.length; i++) {
const testSuite = testSuites[i];
console.log(testSuite);
const testCases = testSuite["elements"].filter(
(element: any) => element.name === "testcase",
);
for (let j = 0; j < testCases.length; j++) {
const testCase = testCases[j];
for (const testSuite of testSuites) {
const testCases =
testSuite["elements"]?.filter(
(element: any) => element.name === "testcase",
) ?? [];

for (const testCase of testCases) {
const testCaseName = testCase["attributes"]["name"];
const testCaseFailure = testCase.filter(
(element: any) => element["elements"][0].name === "failure",
const testCaseFailure = testCase["elements"]?.find(
(element: any) => element.name === "failure",
);

if (testCaseFailure) {
const file = testCase["attributes"]["file"];
const line = testCase["attributes"]["line"];
Expand Down

0 comments on commit b6f9c83

Please sign in to comment.