develop #2
@@ -36,17 +36,32 @@ class CustomReporter implements Reporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private calculateStats(result: FullResult): TestStats {
|
private calculateStats(result: FullResult): TestStats {
|
||||||
const suites = result.suites || [];
|
const allTests = this.testResults;
|
||||||
const allTests = suites.flatMap(suite =>
|
|
||||||
suite.specs.flatMap(spec => spec.tests)
|
if (allTests.length === 0) {
|
||||||
);
|
return {
|
||||||
|
total: 0,
|
||||||
|
passed: 0,
|
||||||
|
failed: 0,
|
||||||
|
skipped: 0,
|
||||||
|
flaky: 0,
|
||||||
|
passRate: 0,
|
||||||
|
failRate: 0,
|
||||||
|
skipRate: 0,
|
||||||
|
flakyRate: 0,
|
||||||
|
totalDuration: 0,
|
||||||
|
avgDuration: 0,
|
||||||
|
slowestTests: [],
|
||||||
|
failedTests: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const passed = allTests.filter(t => t.status === 'passed');
|
const passed = allTests.filter(t => t.status === 'passed');
|
||||||
const failed = allTests.filter(t => t.status === 'failed');
|
const failed = allTests.filter(t => t.status === 'failed');
|
||||||
const skipped = allTests.filter(t => t.status === 'skipped');
|
const skipped = allTests.filter(t => t.status === 'skipped');
|
||||||
const flaky = allTests.filter(t => t.status === 'passed' && t.retry >= 1);
|
const flaky = allTests.filter(t => t.status === 'passed' && t.retry >= 1);
|
||||||
|
|
||||||
const totalDuration = allTests.reduce((sum, t) => sum + (t.duration || 0), 0);
|
const totalDuration = allTests.reduce((sum, t) => sum + t.duration, 0);
|
||||||
const avgDuration = totalDuration / allTests.length;
|
const avgDuration = totalDuration / allTests.length;
|
||||||
|
|
||||||
const passRate = (passed.length / allTests.length) * 100;
|
const passRate = (passed.length / allTests.length) * 100;
|
||||||
@@ -67,8 +82,8 @@ class CustomReporter implements Reporter {
|
|||||||
totalDuration,
|
totalDuration,
|
||||||
avgDuration,
|
avgDuration,
|
||||||
slowestTests: allTests
|
slowestTests: allTests
|
||||||
.filter(t => t.duration)
|
.filter(t => t.duration > 0)
|
||||||
.sort((a, b) => (b.duration || 0) - (a.duration || 0))
|
.sort((a, b) => b.duration - a.duration)
|
||||||
.slice(0, 10),
|
.slice(0, 10),
|
||||||
failedTests: failed,
|
failedTests: failed,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "token",
|
"name": "token",
|
||||||
"value": "eyJhbGciOiJIUzM4NCJ9.eyJyb2xlcyI6W10sInVzZXJJZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInN1YiI6ImFkbWluIiwiaWF0IjoxNzc1NTM4MjAxLCJleHAiOjE3NzU2MjQ2MDF9.2Nnu8oTldNpyqZ-6CsgxAFrK5KpVfv0m97Zbe1uxXnShxRQkQwdSxnY3lY9xk0A4"
|
"value": "eyJhbGciOiJIUzM4NCJ9.eyJyb2xlcyI6W10sInVzZXJJZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInN1YiI6ImFkbWluIiwiaWF0IjoxNzc1NTM4NzgxLCJleHAiOjE3NzU2MjUxODF9.-YWMX8Fdyt8-W0rppNP5QT6t2KI2HMj95LTijW209EBAav4u1lNuZZvBLUp0mbhT"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user