Skip to content

Commit 89825a5

Browse files
committed
chore(gates): name the mock-receiver shapes the Vitest mock-site reader does not follow
1 parent 708b323 commit 89825a5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎scripts/layering/model.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,9 @@ function mockCallMethod(callee: unknown, bindings: VitestBindings): string | und
408408
*
409409
* The receiver is the global `vi`/`vitest`, a name a top-level `import { vi as x } from 'vitest'`
410410
* binds to either, or a member `vi`/`vitest` of a `import * as ns from 'vitest'` namespace. Only
411-
* those import declarations are resolved, and a recognized name counts everywhere in the file; a
412-
* value copied through a variable or a dynamic import is not followed.
411+
* those import declarations are resolved, and a recognized name counts everywhere in the file. A
412+
* value copied through a variable or a destructuring, reached through `globalThis`, `require` or
413+
* a dynamic import, or called through `.call`/`.apply` or a comma expression is not followed.
413414
*/
414415
export function parseModuleMockSpecifiers(source: string): { spec: string; line: number }[] {
415416
const parsed = parseSync('layering-mocks.ts', source);

0 commit comments

Comments
 (0)