Skip to content

Commit

Permalink
Diagnose output
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Chetwin <[email protected]>
  • Loading branch information
tchetwin committed Sep 18, 2024
1 parent ddaf992 commit 8c17dc7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ test("exports correctly working loader hooks", async (t) => {
});

const result = await new Promise<Error | string>((resolve) => {
child.on("exit", (code) => {
child.on("error", (err) => {
resolve(err);
});
child.on("exit", async (code) => {
if (code) {
resolve(new Error(`code: ${code}`));
resolve(
new Error(
`code: ${code}, stdout: "${await text(child.stdout!)}", stderr: "${await text(child.stderr!)}"`,
),
);
}
resolve(text(child.stdout!));
});
Expand Down

0 comments on commit 8c17dc7

Please sign in to comment.