This commit is contained in:
Jarred Sumner
2024-11-16 02:18:13 -08:00
committed by snwy
parent 7eb625e702
commit f141ecc06c
2 changed files with 26 additions and 15 deletions

View File

@@ -339,23 +339,19 @@ pub const Run = struct {
Output.prettyErrorln("Error occurred loading entry point: {s}", .{@errorName(err)});
Output.flush();
}
// TODO: Do a event loop tick when we figure out how to watch the file that wasn't found
// under hot reload mode
vm.exit_handler.exit_code = 1;
vm.onExit();
if (run.any_unhandled) {
bun.JSC.SavedSourceMap.MissingSourceMapNoteInfo.print();
if (vm.hot_reload != .none) {
vm.eventLoop().tick();
vm.eventLoop().tickPossiblyForever();
} else {
vm.exit_handler.exit_code = 1;
vm.onExit();
if (run.any_unhandled) {
bun.JSC.SavedSourceMap.MissingSourceMapNoteInfo.print();
Output.prettyErrorln(
"<r>\n<d>{s}<r>",
.{Global.unhandled_error_bun_version_string},
);
}
vm.globalExit();
Output.prettyErrorln(
"<r>\n<d>{s}<r>",
.{Global.unhandled_error_bun_version_string},
);
}
vm.globalExit();
}
// don't run the GC if we don't actually need to

View File

@@ -17,6 +17,21 @@ beforeEach(() => {
cwd = hotPath;
});
it("preload not found should exit with code 1 and not time out", async () => {
const root = hotRunnerRoot;
const runner = spawn({
cmd: [bunExe(), "--preload=/dev/foobarbarbar", "--hot", root],
env: bunEnv,
stdout: "inherit",
stderr: "pipe",
stdin: "ignore",
});
await runner.exited;
expect(runner.signalCode).toBe(null);
expect(runner.exitCode).toBe(1);
expect(await new Response(runner.stderr).text()).toContain("preload not found");
});
it(
"should hot reload when file is overwritten",
async () => {