Skip to content

Commit 4461787

Browse files
committed
test: improve legacy-cli sub-process error messages
1 parent d4bdc80 commit 4461787

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/legacy-cli/e2e/utils/process.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,24 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<Proce
8888
return new Promise((resolve, reject) => {
8989
let matched = false;
9090

91-
childProcess.on('exit', (error: any) => {
91+
childProcess.on('exit', (error, signal) => {
9292
_processes = _processes.filter((p) => p !== childProcess);
9393

94-
if (options.waitForMatch && !matched) {
95-
error = `Output didn't match '${options.waitForMatch}'.`;
96-
}
97-
9894
if (!error) {
9995
resolve({ stdout, stderr });
10096
return;
10197
}
10298

99+
let errorMsg = `Exit[${error}]Signal[${signal}]`;
100+
if (options.waitForMatch && !matched) {
101+
errorMsg = `Output didn't match '${options.waitForMatch}'.`;
102+
}
103+
103104
reject(
104105
new Error(
105106
`Running "${cmd} ${args.join(
106107
' ',
107-
)}" returned error. ${error}...\n\nSTDOUT:\n${stdout}\n\nSTDERR:\n${stderr}\n`,
108+
)}" returned error. ${errorMsg}...\n\nSTDOUT:\n${stdout}\n\nSTDERR:\n${stderr}\n`,
108109
),
109110
);
110111
});

0 commit comments

Comments
 (0)