From ae16759835c45cc8855061f8f8b7d142d09c9d70 Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:23:14 -0800 Subject: [PATCH 1/4] chore: merge vitest config into vite.config.mts --- vite.config.mts | 24 +++++++++++++++++++++++- vitest.config.ts | 48 ------------------------------------------------ 2 files changed, 23 insertions(+), 49 deletions(-) delete mode 100644 vitest.config.ts diff --git a/vite.config.mts b/vite.config.mts index 713de6866b0..5940ff36187 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -11,7 +11,7 @@ import IconsResolver from 'unplugin-icons/resolver' import Icons from 'unplugin-icons/vite' import Components from 'unplugin-vue-components/vite' import typegpuPlugin from 'unplugin-typegpu/vite' -import { defineConfig } from 'vite' +import { defineConfig } from 'vitest/config' import type { ProxyOptions, UserConfig } from 'vite' import { createHtmlPlugin } from 'vite-plugin-html' import vueDevTools from 'vite-plugin-vue-devtools' @@ -511,5 +511,27 @@ export default defineConfig({ optimizeDeps: { exclude: ['@comfyorg/comfyui-electron-types'], entries: ['index.html'] + }, + + test: { + globals: true, + environment: 'happy-dom', + setupFiles: ['./vitest.setup.ts'], + retry: process.env.CI ? 2 : 0, + include: [ + 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', + 'packages/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}' + ], + coverage: { + reporter: ['text', 'json', 'html'] + }, + exclude: [ + '**/node_modules/**', + '**/dist/**', + '**/cypress/**', + '**/.{idea,git,cache,output,temp}/**', + '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*' + ], + silent: 'passed-only' } }) satisfies UserConfig as UserConfig diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index b74f7496c19..00000000000 --- a/vitest.config.ts +++ /dev/null @@ -1,48 +0,0 @@ -import vue from '@vitejs/plugin-vue' -import { FileSystemIconLoader } from 'unplugin-icons/loaders' -import Icons from 'unplugin-icons/vite' -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - plugins: [ - vue(), - Icons({ - compiler: 'vue3', - customCollections: { - comfy: FileSystemIconLoader('packages/design-system/src/icons') - } - }) - ], - test: { - globals: true, - environment: 'happy-dom', - setupFiles: ['./vitest.setup.ts'], - retry: process.env.CI ? 2 : 0, - include: [ - 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', - 'packages/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}' - ], - coverage: { - reporter: ['text', 'json', 'html'] - }, - exclude: [ - '**/node_modules/**', - '**/dist/**', - '**/cypress/**', - '**/.{idea,git,cache,output,temp}/**', - '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*' - ], - silent: 'passed-only' - }, - resolve: { - alias: { - '@/utils/formatUtil': '/packages/shared-frontend-utils/src/formatUtil.ts', - '@/utils/networkUtil': - '/packages/shared-frontend-utils/src/networkUtil.ts', - '@': '/src' - } - }, - define: { - __USE_PROD_CONFIG__: process.env.USE_PROD_CONFIG === 'true' - } -}) From f8e89068baa4c9b4e765aab6a350ccf4fe5208ac Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:40:31 -0800 Subject: [PATCH 2/4] fix: use vitest types for config instead of vite-only UserConfig --- vite.config.mts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.mts b/vite.config.mts index 5940ff36187..abfce8f35df 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -12,7 +12,7 @@ import Icons from 'unplugin-icons/vite' import Components from 'unplugin-vue-components/vite' import typegpuPlugin from 'unplugin-typegpu/vite' import { defineConfig } from 'vitest/config' -import type { ProxyOptions, UserConfig } from 'vite' +import type { ProxyOptions } from 'vite' import { createHtmlPlugin } from 'vite-plugin-html' import vueDevTools from 'vite-plugin-vue-devtools' @@ -534,4 +534,4 @@ export default defineConfig({ ], silent: 'passed-only' } -}) satisfies UserConfig as UserConfig +}) From 44d3263c2c1a34d4d91e5e2dee7ac5ab90f17333 Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:51:23 -0800 Subject: [PATCH 3/4] chore: block new files in tests-ui/ via lint-staged --- lint-staged.config.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lint-staged.config.mjs b/lint-staged.config.mjs index 97d22c5292b..d158a355da4 100644 --- a/lint-staged.config.mjs +++ b/lint-staged.config.mjs @@ -1,6 +1,8 @@ import path from 'node:path' export default { + 'tests-ui/**': () => 'echo "Files in tests-ui/ are deprecated. Colocate tests with source files." && exit 1', + './**/*.js': (stagedFiles) => formatAndEslint(stagedFiles), './**/*.{ts,tsx,vue,mts}': (stagedFiles) => [ From e8e96cc57b0f1f3180aea77b7e531697255f731c Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:53:16 -0800 Subject: [PATCH 4/4] test: colocate tests from tests-ui/ with source files --- .../tests => src}/composables/graph/useGraphNodeManager.test.ts | 0 {tests-ui => src}/stores/templateRankingStore.test.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {tests-ui/tests => src}/composables/graph/useGraphNodeManager.test.ts (100%) rename {tests-ui => src}/stores/templateRankingStore.test.ts (100%) diff --git a/tests-ui/tests/composables/graph/useGraphNodeManager.test.ts b/src/composables/graph/useGraphNodeManager.test.ts similarity index 100% rename from tests-ui/tests/composables/graph/useGraphNodeManager.test.ts rename to src/composables/graph/useGraphNodeManager.test.ts diff --git a/tests-ui/stores/templateRankingStore.test.ts b/src/stores/templateRankingStore.test.ts similarity index 100% rename from tests-ui/stores/templateRankingStore.test.ts rename to src/stores/templateRankingStore.test.ts