File tree 1 file changed +25
-3
lines changed
packages/vite/src/node/ssr/__tests__
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -331,20 +331,20 @@ test('buildStart before transform', async () => {
331
331
fn ( 'buildStart:out' )
332
332
} ,
333
333
resolveId ( source ) {
334
- expect ( fn ) . toHaveBeenCalledWith ( 'buildStart:out' )
335
334
if ( source === 'virtual:test' ) {
335
+ fn ( 'resolveId' )
336
336
return '\0' + source
337
337
}
338
338
} ,
339
339
load ( id ) {
340
- expect ( fn ) . toHaveBeenCalledWith ( 'buildStart:out' )
341
340
if ( id === '\0virtual:test' ) {
341
+ fn ( 'load' )
342
342
return `export default 'ok'`
343
343
}
344
344
} ,
345
345
transform ( code , id ) {
346
- expect ( fn ) . toHaveBeenCalledWith ( 'buildStart:out' )
347
346
if ( id === '\0virtual:test' ) {
347
+ fn ( 'transform' )
348
348
return code
349
349
}
350
350
} ,
@@ -356,4 +356,26 @@ test('buildStart before transform', async () => {
356
356
357
357
const mod = await server . ssrLoadModule ( 'virtual:test' )
358
358
expect ( mod . default ) . toBe ( 'ok' )
359
+ expect ( fn . mock . calls ) . toMatchInlineSnapshot ( `
360
+ [
361
+ [
362
+ "buildStart:in",
363
+ ],
364
+ [
365
+ "buildStart:out",
366
+ ],
367
+ [
368
+ "resolveId",
369
+ ],
370
+ [
371
+ "resolveId",
372
+ ],
373
+ [
374
+ "load",
375
+ ],
376
+ [
377
+ "transform",
378
+ ],
379
+ ]
380
+ ` )
359
381
} )
You can’t perform that action at this time.
0 commit comments