From 843c53c065b27c8cc545188c0d85a0ca9ad005fd Mon Sep 17 00:00:00 2001 From: pa Date: Fri, 13 Mar 2026 13:47:21 +0900 Subject: [PATCH] fix vitest config --- .gitignore | 2 +- src/views/Tools/__tests__/Tools.test.js | 20 ++++++++++++-------- vitest.config.js | 3 ++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 4c317921..6c65cc2c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ bun.lock AGENTS.md AI_GUIDE.md CLAUDE.md -.coverage/ \ No newline at end of file +coverage/ \ No newline at end of file diff --git a/src/views/Tools/__tests__/Tools.test.js b/src/views/Tools/__tests__/Tools.test.js index bec4e34e..bd1258da 100644 --- a/src/views/Tools/__tests__/Tools.test.js +++ b/src/views/Tools/__tests__/Tools.test.js @@ -12,14 +12,18 @@ const setString = vi.fn(); const friends = ref([]); let routeName = 'not-tools'; -vi.mock('vue-router', () => ({ - useRouter: () => ({ push }), - useRoute: () => ({ - get name() { - return routeName; - } - }) -})); +vi.mock('vue-router', async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + useRouter: () => ({ push }), + useRoute: () => ({ + get name() { + return routeName; + } + }) + }; +}); vi.mock('vue-i18n', () => ({ useI18n: () => ({ t: (key) => key }) diff --git a/vitest.config.js b/vitest.config.js index 0b31c0ab..b1ab8175 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -3,9 +3,10 @@ import { resolve } from 'node:path'; import { defineConfig } from 'vitest/config'; import vue from '@vitejs/plugin-vue'; +import vueJsx from '@vitejs/plugin-vue-jsx'; export default defineConfig({ - plugins: [vue()], + plugins: [vue(),vueJsx()], define: { NIGHTLY: JSON.stringify(false), WINDOWS: JSON.stringify(true),