runner
runner copied to clipboard
Trying to upload non-existing file hangs test suite
Package version
2.2.1
Describe the bug
When trying to upload a file that doesn't exist, the test runner hangs and never prints a summary or exits the process. This used up all my GitHub action minutes whilst I slept last night :(
import { join } from "node:path";
import { test } from "@japa/runner";
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
test.group("Service Provider Profile", async (group) => {
// In my app I'm doing a database transaction
// ------------------------------------------
// group.each.setup(async () => {
// await Database.beginGlobalTransaction();
// return async () => await Database.rollbackGlobalTransaction();
// });
// but this is needed to trigger the hang
// without this setup the hang does not occur
// ------------------------------------------
group.each.setup(async () => {
await sleep(1);
return async () => await sleep(1);
});
test("upload hangs", async ({ client }) => {
await client
.post(`/api/v1/upload`)
.file("avatar", join(__dirname, "../does/not/exist/", "file.jpg"));
});
});
There is a reproduction repo. Simply clone npm install
and run node ace test
.
Reproduction repo
https://github.com/evoactivity/upload-hang-reproduction