fix: read exit code of bun test in test runner

this will avoid duplicate error output
This commit is contained in:
2024-06-15 20:14:51 -04:00
parent 01478df269
commit 21d99d1b5c

View File

@@ -23,6 +23,7 @@ const positionalArgs = Object.entries(args)
console.log(formatCmd(args["dbCommand"]));
const dbProcess = $({ quote: (arg) => arg })`${args["dbCommand"]}`.nothrow();
let exitCode = 0;
try {
$.env = {
...getTestEnvVariables(),
@@ -31,10 +32,13 @@ try {
SHOULD_LOG_ERRORS: process.env["SHOULD_LOG_ERRORS"] ?? "true",
};
await $`bun db:migrate`.nothrow();
await $({
const testProcess = await $({
verbose: true,
quote: (arg) => arg,
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`;
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`.nothrow();
exitCode = (await testProcess.exitCode) ?? 0;
} finally {
await dbProcess.kill("SIGINT");
}
process.exit(exitCode);