Skip to content

Commit

Permalink
Add a note about vite transform error console assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
szymmis committed Jan 25, 2024
1 parent b1530a2 commit 52eb839
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ describe.each(["development", "production"] as const)(
test("subpath html is served correctly", async () => {
const spyConsolError = vi.spyOn(console, "error");
let response = await request(app).get("/subpath/");
expect(spyConsolError).not.toHaveBeenCalled();
expect(response.text).toMatch(/<h1>subpath<\/h1>/);
response = await request(app).get("/subpath/route");
expect(response.text).toMatch(/<h1>subpath<\/h1>/);
// FIXME: Find a better way to do this
// Assert that Vite is not printing pre-transform error to console
// when resolving subpath/script.js as a relative import
//
// https://github.com/szymmis/vite-express/pull/114
expect(spyConsolError).not.toHaveBeenCalled();
vi.restoreAllMocks();
});

Expand Down

0 comments on commit 52eb839

Please sign in to comment.