Skip to content

Commit

Permalink
fix: allow reassigning global mocks (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Feb 19, 2022
1 parent 506b196 commit 7b34793
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vitest/src/node/mocker.ts
Expand Up @@ -72,18 +72,18 @@ export class VitestMocker {
(this.callbacks[event] ?? []).forEach(fn => fn(...args))
}

public getSuiteFilepath() {
public getSuiteFilepath(): string {
return __vitest_worker__?.filepath || 'global'
}

public getMocks() {
const suite = this.getSuiteFilepath()
const suiteMocks = this.mockMap[suite || '']
const suiteMocks = this.mockMap[suite]
const globalMocks = this.mockMap.global

return {
...suiteMocks,
...globalMocks,
...suiteMocks,
}
}

Expand Down

0 comments on commit 7b34793

Please sign in to comment.