mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-01 03:31:58 +00:00
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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user