Inconsistent behaviour of `aot` with `noop` handler / empty response
bogeychan opened this issue · comments
Bogeychan commented
What version of Elysia.JS is running?
1.1.3
What platform is your computer?
WSL Ubuntu
What steps can reproduce the bug?
// test.test.ts
import { Elysia } from "elysia";
import { describe, it, expect } from "bun:test";
describe("AOT", () => {
it.each([
["enabled", { aot: true }],
["disabled", { aot: false }],
])("aot %s should respond without error", async (_name, options) => {
const app = new Elysia(options).get("/", () => {
// noop
});
const response = await app.handle(new Request("http://localhost/"));
expect(response.status).toBe(200);
});
});
bun test
What is the expected behavior?
Both tests pass:
✓ AOT > aot enabled should respond without error
✓ AOT > aot disabled should respond without error
What do you see instead?
aot: false
test fails:
✓ AOT > aot enabled should respond without error
11 | // noop
12 | });
13 |
14 | const response = await app.handle(new Request("http://localhost/"));
15 |
16 | expect(response.status).toBe(200);
^
error: expect(received).toBe(expected)
Expected: 200
Received: 500
✗ AOT > aot disabled should respond without error
Additional information
It fails with status code 500 because of this:
undefined is not an object (evaluating 'M[m]')
Bogeychan commented
ty, works for me