Skip to content

Commit 54ae20b

Browse files
committed
print all spawnCoanaDlx output on errors in CI
1 parent eaec268 commit 54ae20b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/utils/dlx.mts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ import { spawn } from '@socketsecurity/registry/lib/spawn'
2525

2626
import { getDefaultOrgSlug } from '../commands/ci/fetch-default-org-slug.mts'
2727
import constants, {
28+
CI,
2829
FLAG_QUIET,
2930
FLAG_SILENT,
3031
NPM,
3132
PNPM,
33+
VITEST,
3234
YARN,
3335
} from '../constants.mts'
3436
import { getErrorCause } from './errors.mts'
@@ -275,9 +277,28 @@ export async function spawnCoanaDlx(
275277
spawnExtra,
276278
)
277279
const output = await result.spawnPromise
280+
// Print output when running in e2e-tests workflow for debugging.
281+
if (CI && VITEST) {
282+
if (output.stdout) {
283+
console.log(output.stdout)
284+
}
285+
if (output.stderr) {
286+
console.error(output.stderr)
287+
}
288+
}
278289
return { ok: true, data: output.stdout }
279290
} catch (e) {
291+
const stdout = (e as any)?.stdout
280292
const stderr = (e as any)?.stderr
293+
// Print output when running in e2e-tests workflow for debugging.
294+
if (CI && VITEST) {
295+
if (stdout) {
296+
console.log(stdout)
297+
}
298+
if (stderr) {
299+
console.error(stderr)
300+
}
301+
}
281302
const cause = getErrorCause(e)
282303
const message = stderr || cause
283304
return {

0 commit comments

Comments
 (0)