File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -3597,6 +3597,15 @@ export default class Elysia<
35973597 }
35983598
35993599 return instance
3600+ } else if ( plugin . promisedModules . size > 0 ) {
3601+ for ( const promise of plugin . promisedModules . promises )
3602+ this . promisedModules . add ( promise )
3603+
3604+ this . promisedModules
3605+ . then ( ( ) => this . _use ( plugin ) )
3606+ . then ( ( x ) => x . compile ( ) )
3607+
3608+ return this
36003609 }
36013610
36023611 const { name, seed } = plugin . config
Original file line number Diff line number Diff line change 1+ import { Elysia } from '../../src'
2+
3+ import { describe , expect , it } from 'bun:test'
4+ import { req } from '../utils'
5+
6+ describe ( 'Plugin' , ( ) => {
7+ it ( 'await async nested plugin' , async ( ) => {
8+ const yay = async ( ) => {
9+ await Bun . sleep ( 1_000 )
10+
11+ return new Elysia ( { name : 'yay' } ) . get ( '/yay' , 'yay' )
12+ }
13+
14+ const wrapper = new Elysia ( { name : 'wrapper' } ) . use ( yay ( ) )
15+
16+ const app = new Elysia ( ) . use ( wrapper )
17+
18+ await app . modules
19+
20+ const response = await app . handle ( req ( '/yay' ) )
21+
22+ expect ( response . status ) . toBe ( 200 )
23+ } )
24+ } )
You can’t perform that action at this time.
0 commit comments