diff --git a/neode-ui/vitest.config.ts b/neode-ui/vitest.config.ts index fa838be1..96d9facc 100644 --- a/neode-ui/vitest.config.ts +++ b/neode-ui/vitest.config.ts @@ -12,6 +12,7 @@ export default defineConfig({ test: { environment: 'jsdom', globals: true, + setupFiles: ['./vitest.setup.ts'], root: '.', passWithNoTests: true, exclude: ['e2e/**', 'node_modules/**', '**/._*'], diff --git a/neode-ui/vitest.setup.ts b/neode-ui/vitest.setup.ts new file mode 100644 index 00000000..83409a41 --- /dev/null +++ b/neode-ui/vitest.setup.ts @@ -0,0 +1,9 @@ +import { config } from '@vue/test-utils' +import { displayVersion } from '@/utils/version' + +// The app registers `$ver` as a global template property in main.ts +// (app.config.globalProperties.$ver = displayVersion). Component tests mount +// without that bootstrap, so provide the same global here for every mounted +// component. Per-mount `global` options merge with this, so individual tests +// keep their own plugins/mocks. +config.global.mocks = { ...(config.global.mocks ?? {}), $ver: displayVersion }