Skip to content

Commit

Permalink
fixup! test(cosmic-swingset): Include the last three lines of stderr …
Browse files Browse the repository at this point in the history
…when a make test fails
  • Loading branch information
gibson042 authored Nov 9, 2024
1 parent c60788c commit bfe23d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/cosmic-swingset/test/scenario2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ export const pspawn = (bin, { spawn, cwd }) => {
const exit = new Promise((resolve, reject) => {
// When stderr is otherwise ignored, spy on it for inclusion in error messages.
/** @type {Promise<string> | undefined} */
let stderrP = Promise.resolve('');
let stderrP;
// https://nodejs.org/docs/latest/api/child_process.html#optionsstdio
let { stdio = 'pipe' } = opts;
if (stdio === 'ignore' || stdio[2] === 'ignore') {
stderrP = undefined;
stdio = typeof stdio === 'string' ? [stdio, stdio, stdio] : [...stdio];
stdio[2] = 'pipe';
} else {
// The caller is not ignoring stderr, so we pretend it is empty here.
stderrP = Promise.resolve('');
}
const resolvedOpts = { cwd, ...opts, stdio };
// console.debug('spawn', bin, args, resolvedOpts);
Expand Down

0 comments on commit bfe23d4

Please sign in to comment.