fix: test runner not exiting with code 1 when test fails

This commit is contained in:
2024-06-15 19:05:55 -04:00
parent 5d528fba52
commit 1c8d5a1a42

View File

@@ -23,16 +23,18 @@ 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();
$.env = { try {
...getTestEnvVariables(), $.env = {
PATH: process.env["PATH"], ...getTestEnvVariables(),
HOME: process.env["HOME"], PATH: process.env["PATH"],
SHOULD_LOG_ERRORS: process.env["SHOULD_LOG_ERRORS"] ?? "true", HOME: process.env["HOME"],
}; SHOULD_LOG_ERRORS: process.env["SHOULD_LOG_ERRORS"] ?? "true",
await $`bun db:migrate`.nothrow(); };
await $({ await $`bun db:migrate`.nothrow();
verbose: true, await $({
quote: (arg) => arg, verbose: true,
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`.nothrow(); quote: (arg) => arg,
})`FORCE_COLOR=1 bun test ${positionalArgs.join(" ")}`;
await dbProcess.kill("SIGINT"); } finally {
await dbProcess.kill("SIGINT");
}