refactor: replace vi.doMock with vi.mock + vi.hoisted (#8319)

Replace `vi.doMock` with `vi.mock` + `vi.hoisted` pattern for cleaner
test mocking.

- Add ESLint rule to prevent future `doMock` usage
- Refactor `versionUtil.test.ts` and `firebaseAuthStore.test.ts`

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8319-refactor-replace-vi-doMock-with-vi-mock-vi-hoisted-2f46d73d365081ae9fccf2fa7471a75b)
by [Unito](https://www.unito.io)

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-26 14:08:54 -08:00
committed by GitHub
parent b551064a6a
commit 6a5b5c968f
3 changed files with 62 additions and 80 deletions

View File

@@ -240,6 +240,20 @@ export default defineConfig([
]
}
},
{
files: ['**/*.test.ts'],
rules: {
'no-restricted-properties': [
'error',
{
object: 'vi',
property: 'doMock',
message:
'Use vi.mock() with vi.hoisted() instead of vi.doMock(). See docs/testing/vitest-patterns.md'
}
]
}
},
{
files: ['scripts/**/*.js'],
languageOptions: {