Skip to content

Commit 0ce70ca

Browse files
author
Alex Plischke
authored
fix: incorrect handling of tests that never ran properly (#48)
1 parent 88c71b4 commit 0ce70ca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/reporter.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default class SauceReporter implements Reporter {
182182
try {
183183
await this.reportTestRun(projectSuite, report, result?.id);
184184
} catch (e: any) {
185-
console.warn('failed to send report to insights, ', e.stack());
185+
console.warn('failed to send report to insights: ', e);
186186
}
187187
}
188188

@@ -244,6 +244,10 @@ export default class SauceReporter implements Reporter {
244244
let duration = 0;
245245
for (const suite of projectSuite.suites) {
246246
suite.tests.forEach((t: TestCase) => {
247+
if (t.results.length < 1) {
248+
return;
249+
}
250+
247251
const lastResult = t.results[t.results.length - 1];
248252
duration += lastResult.duration;
249253
});
@@ -255,6 +259,10 @@ export default class SauceReporter implements Reporter {
255259
const errors: TestRunError[] = [];
256260
for (const suite of projectSuite.suites) {
257261
suite.tests.forEach((t: TestCase) => {
262+
if (t.results.length < 1) {
263+
return;
264+
}
265+
258266
const lastResult = t.results[t.results.length - 1];
259267
if (lastResult.error) {
260268
errors.push(lastResult.error);

0 commit comments

Comments
 (0)