Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
51 lines (49 loc) · 1.75 KB
/
Copy pathvitest.config.mts
File metadata and controls
51 lines (49 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { fileURLToPath } from 'node:url'
import { lingui } from '@lingui/vite-plugin'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'
const serverOnlyTestStub = '\0server-only-test-stub'
export default defineConfig({
plugins: [{
name: 'server-only-test-stub',
enforce: 'pre',
resolveId(id) {
if (id === 'server-only') return serverOnlyTestStub
},
load(id) {
if (id === serverOnlyTestStub) return 'export {}'
},
}, tsconfigPaths(), react({
babel: {
plugins: ['@lingui/babel-plugin-lingui-macro'],
},
}), lingui()],
resolve: {
alias: {
// The `mqtt` npm package is added by sleepypod-core-28 (frontend PR).
// Until that lands, alias it to a local test stub so the bridge module
// is resolvable under vitest. Tests then layer vi.mock('mqtt') on top
// to control behaviour.
mqtt: fileURLToPath(new URL('./src/streaming/tests/__stubs__/mqtt.ts', import.meta.url)),
},
},
test: {
globals: true,
environment: 'jsdom',
reporters: ['junit', 'verbose'],
outputFile: {
junit: process.env.VITEST_JUNIT_OUTPUT || 'test-results/junit.xml',
},
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'json-summary'],
// Count production files even when no test imports them. Otherwise new,
// untested components disappear from the coverage denominator entirely.
include: ['src/**/*.{ts,tsx}', 'app/**/*.{ts,tsx}', 'instrumentation.ts', 'proxy.ts'],
exclude: ['**/tests/**', '**/*.test.{ts,tsx}', '**/*.d.ts'],
},
name: 'unit',
exclude: ['.claude/worktrees/**', '.codex/**', '.ygg/worktrees/**', 'node_modules/**', '.next/**'],
},
})