Skip to content

Commit

Permalink
tasks: skip writing junit no failure if it has already been reported
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 8, 2022
1 parent 4fdc831 commit 28e8c4e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/task.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable no-await-in-loop */
import { AbortController } from 'node-abort-controller';
import type { AbortController } from 'node-abort-controller';
import { getJunitXml } from 'junit-xml';
import { outputFile, existsSync, readFile } from 'fs-extra';
import { join, resolve } from 'path';
import { prompt } from 'prompts';
import boxen from 'boxen';
import { dedent } from 'ts-dedent';

import { createOptions, getCommand, getOptionsOrPrompt, OptionValues } from './utils/options';
import type { OptionValues } from './utils/options';
import { createOptions, getCommand, getOptionsOrPrompt } from './utils/options';
import { install } from './tasks/install';
import { compile } from './tasks/compile';
import { check } from './tasks/check';
Expand Down Expand Up @@ -278,7 +279,10 @@ async function runTask(task: Task, details: TemplateDetails, optionValues: Passe

return controller;
} catch (err) {
if (junitFilename) await writeJunitXml(getTaskKey(task), details.key, startTime, err);
// If there's a non-test related error (junit report has not been reported already), we report the general failure in a junit report
if (junitFilename && !existsSync(junitFilename)) {
await writeJunitXml(getTaskKey(task), details.key, startTime, err);
}

throw err;
} finally {
Expand Down

0 comments on commit 28e8c4e

Please sign in to comment.