fix: read exit code of bun test in test runner
this will avoid duplicate error output
This commit is contained in:
@@ -23,6 +23,7 @@ const positionalArgs = Object.entries(args)
|
|||||||
console.log(formatCmd(args["dbCommand"]));
|
console.log(formatCmd(args["dbCommand"]));
|
||||||
const dbProcess = $({ quote: (arg) => arg })`${args["dbCommand"]}`.nothrow();
|
const dbProcess = $({ quote: (arg) => arg })`${args["dbCommand"]}`.nothrow();
|
||||||
|
|
||||||
|
let exitCode = 0;
|
||||||
try {
|
try {
|
||||||
$.env = {
|
$.env = {
|
||||||
...getTestEnvVariables(),
|
...getTestEnvVariables(),
|
||||||
@@ -31,10 +32,13 @@ try {
|
|||||||
SHOULD_LOG_ERRORS: process.env["SHOULD_LOG_ERRORS"] ?? "true",
|
SHOULD_LOG_ERRORS: process.env["SHOULD_LOG_ERRORS"] ?? "true",
|
||||||
};
|
};
|
||||||
await $`bun db:migrate`.nothrow();
|
await $`bun db:migrate`.nothrow();
|
||||||
await $({
|
const testProcess = await $({
|
||||||
verbose: true,
|
verbose: true,
|
||||||
quote: (arg) => arg,
|
quote: (arg) => arg,
|
||||||
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`;
|
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`.nothrow();
|
||||||
|
exitCode = (await testProcess.exitCode) ?? 0;
|
||||||
} finally {
|
} finally {
|
||||||
await dbProcess.kill("SIGINT");
|
await dbProcess.kill("SIGINT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.exit(exitCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user