File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,22 @@ export async function startMockServer() {
4949 await kernel . use ( new AppPlugin ( appConfig ) )
5050
5151 // MSW Plugin (intercepts network requests)
52- await kernel . use ( new MSWPlugin ( {
52+ const mswPlugin = new MSWPlugin ( {
5353 enableBrowser : true ,
5454 baseUrl : '/api/v1' ,
5555 logRequests : true
56- } ) ) ;
56+ } ) ;
57+
58+ // WORKAROUND: ObjectRuntime's PluginLoader spreads the plugin object ({ ...plugin }),
59+ // which strips methods from class instances (prototype methods).
60+ // We must bind 'init' and 'start' as own properties.
61+ const fixedMswPlugin = {
62+ ...mswPlugin ,
63+ init : mswPlugin . init . bind ( mswPlugin ) ,
64+ start : mswPlugin . start ? mswPlugin . start . bind ( mswPlugin ) : undefined
65+ } ;
66+
67+ await kernel . use ( fixedMswPlugin ) ;
5768
5869 await kernel . bootstrap ( ) ;
5970
You can’t perform that action at this time.
0 commit comments