Files
openmotion/studio/vitest.config.ts
open-design-crew[bot] 0bbac58419 perf(studio): lazy-load i18n dictionaries by locale and add governance checks (#820)
* perf(studio): lazy-load i18n dictionaries by locale and add governance checks

* fix(studio): emit numeric delta hashes for i18n keys to avoid gitleaks false positives

---------

Co-authored-by: 罗高 <luogao@users.noreply.github.com>
2026-11-22 09:59:39 +08:00

26 lines
1.2 KiB
TypeScript

import { defineConfig, mergeConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';
import viteConfig from './vite.config';
import { openmotionI18nPlugin } from './vite-i18n-plugin';
// Unit/DOM tests need the production aliases and defines, but not CSS generation
// or React Fast Refresh. Vite's automatic JSX transform still compiles the same JSX.
export default mergeConfig({ ...viteConfig, plugins: [openmotionI18nPlugin()] }, defineConfig({
resolve: { alias: [{ find: /^@hyperframes\/studio$/, replacement: fileURLToPath(new URL('./src/index.ts', import.meta.url)) }] },
esbuild: { jsx: 'automatic', define: { 'import.meta.hot': 'undefined' } },
test: {
include: ['src/**/*.test.{ts,tsx}'],
// Real Chrome benches are retained separately; this command runs unit/DOM suites.
exclude: ['src/**/*.browser.test.ts'],
setupFiles: ['src/test-setup.ts'],
maxWorkers: 4,
pool: 'threads',
// DOM environments own storage; Node 25+ otherwise shadows it with a server global.
execArgv: ['--no-experimental-webstorage'],
environmentOptions: {
// Upstream edit tests populate about:blank composition documents themselves.
happyDOM: { settings: { enableIframePageLoading: true } },
},
},
}));