Skip to content

Commit bf4c55f

Browse files
committed
test: tweak
1 parent 40903c9 commit bf4c55f

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

packages/vite/src/node/ssr/__tests__/ssrLoadModule.spec.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -331,20 +331,20 @@ test('buildStart before transform', async () => {
331331
fn('buildStart:out')
332332
},
333333
resolveId(source) {
334-
expect(fn).toHaveBeenCalledWith('buildStart:out')
335334
if (source === 'virtual:test') {
335+
fn('resolveId')
336336
return '\0' + source
337337
}
338338
},
339339
load(id) {
340-
expect(fn).toHaveBeenCalledWith('buildStart:out')
341340
if (id === '\0virtual:test') {
341+
fn('load')
342342
return `export default 'ok'`
343343
}
344344
},
345345
transform(code, id) {
346-
expect(fn).toHaveBeenCalledWith('buildStart:out')
347346
if (id === '\0virtual:test') {
347+
fn('transform')
348348
return code
349349
}
350350
},
@@ -356,4 +356,26 @@ test('buildStart before transform', async () => {
356356

357357
const mod = await server.ssrLoadModule('virtual:test')
358358
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+
`)
359381
})

0 commit comments

Comments
 (0)