mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[jest/ci-stats] when jest fails to execute a test file, report it as a failure (#132527)
This commit is contained in:
parent
d12156ec22
commit
dd6dacf003
1 changed files with 7 additions and 1 deletions
|
@ -41,6 +41,7 @@ export default class CiStatsJestReporter extends BaseReporter {
|
|||
private startTime: number | undefined;
|
||||
private passCount = 0;
|
||||
private failCount = 0;
|
||||
private testExecErrorCount = 0;
|
||||
|
||||
private group: CiStatsReportTestsOptions['group'] | undefined;
|
||||
private readonly testRuns: CiStatsReportTestsOptions['testRuns'] = [];
|
||||
|
@ -90,6 +91,10 @@ export default class CiStatsJestReporter extends BaseReporter {
|
|||
return;
|
||||
}
|
||||
|
||||
if (testResult.testExecError) {
|
||||
this.testExecErrorCount += 1;
|
||||
}
|
||||
|
||||
let elapsedTime = 0;
|
||||
for (const t of testResult.testResults) {
|
||||
const result = t.status === 'failed' ? 'fail' : t.status === 'passed' ? 'pass' : 'skip';
|
||||
|
@ -123,7 +128,8 @@ export default class CiStatsJestReporter extends BaseReporter {
|
|||
}
|
||||
|
||||
this.group.durationMs = Date.now() - this.startTime;
|
||||
this.group.result = this.failCount ? 'fail' : this.passCount ? 'pass' : 'skip';
|
||||
this.group.result =
|
||||
this.failCount || this.testExecErrorCount ? 'fail' : this.passCount ? 'pass' : 'skip';
|
||||
|
||||
await this.reporter.reportTests({
|
||||
group: this.group,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue