@@ -6,7 +6,7 @@ import { resolveCodeServerOptions, setup } from '../src/integrations/code-server
66
77const mocks = vi . hoisted ( ( ) => ( {
88 createCodeServerDevframe : vi . fn ( ) ,
9- mountDevframe : vi . fn ( ) ,
9+ install : vi . fn ( ) ,
1010 setupCodeServer : vi . fn ( ) ,
1111 dispose : vi . fn ( ) ,
1212} ) )
@@ -19,10 +19,6 @@ vi.mock('@devframes/plugin-code-server/node', () => ({
1919 setupCodeServer : mocks . setupCodeServer ,
2020} ) )
2121
22- vi . mock ( '@vitejs/devtools-kit/node' , ( ) => ( {
23- mountDevframe : mocks . mountDevframe ,
24- } ) )
25-
2622function fakeContext ( moduleOptions : Record < string , any > = { } ) {
2723 const hooks = createHooks ( )
2824 const nuxt = {
@@ -52,7 +48,7 @@ beforeEach(() => {
5248 setup : vi . fn ( ) ,
5349 } ) )
5450 mocks . setupCodeServer . mockResolvedValue ( { dispose : mocks . dispose } )
55- mocks . mountDevframe . mockImplementation ( async ( _kit , definition ) => {
51+ mocks . install . mockImplementation ( async ( definition ) => {
5652 await definition . setup ( { cwd : '/project' } )
5753 } )
5854} )
@@ -114,7 +110,7 @@ describe('code server setup', () => {
114110 await nuxt . callHook ( 'devtools:ready' , { } as any )
115111
116112 expect ( mocks . createCodeServerDevframe ) . not . toHaveBeenCalled ( )
117- expect ( mocks . mountDevframe ) . not . toHaveBeenCalled ( )
113+ expect ( mocks . install ) . not . toHaveBeenCalled ( )
118114 } )
119115
120116 it ( 'mounts the plugin in the Nuxt group and disposes its supervisor on close' , async ( ) => {
@@ -127,10 +123,9 @@ describe('code server setup', () => {
127123 serverPort : 9090 ,
128124 } ) )
129125
130- const kit = { id : 'kit' }
126+ const kit = { id : 'kit' , install : mocks . install }
131127 await nuxt . callHook ( 'devtools:ready' , kit as any )
132- expect ( mocks . mountDevframe ) . toHaveBeenCalledWith (
133- kit ,
128+ expect ( mocks . install ) . toHaveBeenCalledWith (
134129 expect . objectContaining ( { id : 'devframes_plugin_code-server' } ) ,
135130 {
136131 dock : {
@@ -157,7 +152,7 @@ describe('code server setup', () => {
157152 const { ctx, nuxt } = fakeContext ( )
158153 setup ( ctx )
159154
160- const ready = nuxt . callHook ( 'devtools:ready' , { id : 'kit' } as any )
155+ const ready = nuxt . callHook ( 'devtools:ready' , { id : 'kit' , install : mocks . install } as any )
161156 await vi . waitFor ( ( ) => {
162157 expect ( mocks . setupCodeServer ) . toHaveBeenCalledOnce ( )
163158 } )
0 commit comments