Skip to content

Commit 2639ea4

Browse files
fix: make stdin not blocking in doctor user tests
1 parent 85cfd22 commit 2639ea4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

test/jest/acceptance/doctor.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ describe('snyk doctor', () => {
1010

1111
describe('use doctor on the current system (live checks)', () => {
1212
it('outputs a human readable report', async () => {
13-
const { code, stdout, stderr } = await runSnykCLI('doctor dahsjdhkas', {
14-
env,
15-
});
16-
console.log(stderr);
13+
const { code, stdout } = await runSnykCLI('doctor --live', { env });
14+
1715
expect(code).toBe(0);
1816
expect(stdout).toContain('Snyk Doctor Diagnostic Report');
1917
});

test/jest/util/runCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const runCommand = (
2424
): Promise<RunCommandResult> => {
2525
return new Promise((resolve, reject) => {
2626
const child = spawn(command, args, options);
27+
// ponytail: default pipe stdin blocks commands that read until EOF (e.g. doctor)
28+
child.stdin?.end();
2729
const stdout: Buffer[] = [];
2830
const stderr: Buffer[] = [];
2931

0 commit comments

Comments
 (0)