@empiricalrun/reporter
Advanced tools
Comparing version 0.14.1 to 0.14.2
# @empiricalrun/reporter | ||
## 0.14.2 | ||
### Patch Changes | ||
- cc33982: feat: show flaky tests in reporter in mobile platforms | ||
## 0.14.1 | ||
@@ -4,0 +10,0 @@ |
@@ -7,3 +7,3 @@ export interface AppiumTest { | ||
flake: boolean; | ||
suite: string; | ||
testCaseId: string; | ||
} | ||
@@ -10,0 +10,0 @@ export interface AppiumSummary { |
@@ -25,3 +25,3 @@ "use strict"; | ||
flake: false, | ||
suite: result["ns2:test-suite"].name, | ||
testCaseId: testCase.testCaseId, | ||
}; | ||
@@ -43,2 +43,38 @@ }); | ||
} | ||
function modifyTestsToHandleFlakyCases(testCases) { | ||
let modifiedTests = []; | ||
testCases.forEach((testCase) => { | ||
if (isTestFlaky(testCases, testCase.testCaseId, testCase.status)) { | ||
const passedTest = getPassedTest(testCases, testCase.testCaseId); | ||
if (passedTest) { | ||
passedTest.flake = true; | ||
const isAlreadyProcessed = modifiedTests.some((test) => test.testCaseId === passedTest.testCaseId); | ||
if (!isAlreadyProcessed) { | ||
modifiedTests.push(passedTest); | ||
} | ||
} | ||
} | ||
else { | ||
const isAlreadyProcessed = modifiedTests.some((test) => test.testCaseId === testCase.testCaseId); | ||
if (!isAlreadyProcessed) { | ||
modifiedTests.push(testCase); | ||
} | ||
} | ||
}); | ||
return modifiedTests; | ||
} | ||
function isTestFlaky(testCases, testId, status) { | ||
// A test is flaky if it has both passed and failed/broken status across retries | ||
if (status === "passed") { | ||
return testCases.some((testCase) => testCase.testCaseId === testId && | ||
(testCase.status === "failed" || testCase.status === "broken")); | ||
} | ||
else if (status === "failed" || status === "broken") { | ||
return testCases.some((testCase) => testCase.testCaseId === testId && testCase.status === "passed"); | ||
} | ||
return false; | ||
} | ||
function getPassedTest(testCases, testId) { | ||
return testCases.find((testCase) => testCase.testCaseId == testId && testCase.status === "passed"); | ||
} | ||
function parsedSummary(testCases) { | ||
@@ -94,4 +130,5 @@ const hasTestCases = testCases.length > 0; | ||
} | ||
testCases = modifyTestsToHandleFlakyCases(testCases); | ||
return parsedSummary(testCases); | ||
} | ||
exports.generateJsonFile = generateJsonFile; |
{ | ||
"name": "@empiricalrun/reporter", | ||
"version": "0.14.1", | ||
"version": "0.14.2", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "registry": "https://registry.npmjs.org/", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71430
1561