You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{it,expect}from"bun:test";import{Elysia}from"elysia";constasyncPlugin=Promise.resolve(newElysia({name: "AsyncPlugin"}));constplugin=newElysia({name: "Plugin"}).use(asyncPlugin).get("/plugin",()=>"GET /plugin");constapp=newElysia({name: "App"}).use(plugin).get("/foo",()=>"GET /foo").listen(3000);it("matches the right route",async()=>{constresponse=awaitapp.handle(newRequest("http://localhost/plugin"));consttext=awaitresponse.text();expect(text).toEqual("GET /plugin");});
What is the expected behavior?
The test should pass.
What do you see instead?
The test fails. expect receives GET /foo instead of GET /plugin.
Additional information
This issue was present in 1.2.14, see #1067. It is still present in 1.2.15.
There is a semi-obvious workaround for this, awaiting the async plugin, but that means any plugins using it will have to be async too if they weren't before. Personally, it's not a deal breaker, but it feels unexpected and is not easy to detect.
I stumbled into this bug while using the @elysiajs/swagger package.
Bun version: 1.2.2+c1708ea6a
Have you try removing the node_modules and bun.lockb and try again yet?
Yes
The text was updated successfully, but these errors were encountered:
What version of Elysia is running?
1.2.15
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What steps can reproduce the bug?
Run this test:
What is the expected behavior?
The test should pass.
What do you see instead?
The test fails.
expect
receivesGET /foo
instead ofGET /plugin
.Additional information
This issue was present in 1.2.14, see #1067. It is still present in 1.2.15.
There is a semi-obvious workaround for this, awaiting the async plugin, but that means any plugins using it will have to be
async
too if they weren't before. Personally, it's not a deal breaker, but it feels unexpected and is not easy to detect.I stumbled into this bug while using the
@elysiajs/swagger
package.Bun version: 1.2.2+c1708ea6a
Have you try removing the
node_modules
andbun.lockb
and try again yet?Yes
The text was updated successfully, but these errors were encountered: