diff --git a/packages/cosmic-swingset/test/captp-fixture.js b/packages/cosmic-swingset/test/captp-fixture.js index e1d1776be6a..23c7103a303 100644 --- a/packages/cosmic-swingset/test/captp-fixture.js +++ b/packages/cosmic-swingset/test/captp-fixture.js @@ -9,30 +9,35 @@ const PORT = 7999; // Ensure we're all using the same HandledPromise. export { E }; -export async function makeFixture() { +export async function makeFixture(noisy = false) { const accessToken = await getAccessToken(PORT); let expectedToExit = false; let buf = ''; + const stdio = noisy + ? ['ignore', 'inherit', 'inherit'] + : ['ignore', 'pipe', 'pipe']; const cp = spawn( 'make', ['scenario3-setup', 'scenario3-run', `BASE_PORT=${PORT}`], { cwd: `${__dirname}/..`, env: { ...process.env, PORT }, - stdio: ['ignore', 'pipe', 'pipe'], + stdio, detached: true, }, ); - cp.stdout.on('data', chunk => (buf += chunk.toString('utf-8'))); - cp.stderr.on('data', chunk => { - const msg = chunk.toString('utf-8'); - if (!msg.match(/^make: \*\*\*.*99/)) { - // Write chunks that don't describe the exit status. - process.stderr.write(chunk); - } - }); + if (!noisy) { + cp.stdout.on('data', chunk => (buf += chunk.toString('utf-8'))); + cp.stderr.on('data', chunk => { + const msg = chunk.toString('utf-8'); + if (!msg.match(/^make: \*\*\*.*99/)) { + // Write chunks that don't describe the exit status. + process.stderr.write(chunk); + } + }); + } /** @type {WebSocket} */ let ws; @@ -122,10 +127,11 @@ export async function makeFixture() { // Don't kill on exit anymore, as we're doing it now. process.off('exit', kill); // console.log('killing!'); - process.kill(-cp.pid, 'SIGINT'); + process.kill(-cp.pid, 'SIGTERM'); } process.on('exit', kill); process.on('SIGINT', kill); + process.on('SIGTERM', kill); return { homeP: connect(), kill }; } diff --git a/packages/cosmic-swingset/test/test-home.js b/packages/cosmic-swingset/test/test-home.js index 292175392f1..c287d5363f3 100644 --- a/packages/cosmic-swingset/test/test-home.js +++ b/packages/cosmic-swingset/test/test-home.js @@ -8,7 +8,7 @@ import { makeFixture, E } from './captp-fixture'; let home; let teardown; test.before('setup', async t => { - const { homeP, kill } = await makeFixture(); + const { homeP, kill } = await makeFixture(process.env.NOISY); teardown = kill; home = await homeP; t.truthy('ready');