MCPcopy
hub / github.com/vitest-dev/vitest / transform

Function transform

packages/mocker/src/node/automockPlugin.ts:12–21  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

10 name: 'vitest:automock',
11 enforce: 'post',
12 transform(code, id) {
13 if (id.includes('mock=automock') || id.includes('mock=autospy')) {
14 const mockType = id.includes('mock=automock') ? 'automock' : 'autospy'
15 const ms = automockModule(code, mockType, this.parse, options)
16 return {
17 code: ms.toString(),
18 map: ms.generateMap({ hires: 'boundary', source: cleanUrl(id) }),
19 }
20 }
21 },
22 }
23}

Callers

nothing calls this directly

Calls 3

automockModuleFunction · 0.90
cleanUrlFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected