feat: add vitest configuration file
- add vitest configuration - update tsconfig.json so that test files does not throw error with global definitions such as expect, test
This commit is contained in:
@@ -12,9 +12,10 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "Bundler",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
|
"types": ["vitest/globals"],
|
||||||
|
|
||||||
// TODO: Enable the following options later.
|
// TODO: Enable the following options later.
|
||||||
// "forceConsistentCasingInFileNames": true,
|
// "forceConsistentCasingInFileNames": true,
|
||||||
|
|||||||
31
vitest.config.js
Normal file
31
vitest.config.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { defineConfig, mergeConfig } from 'vitest/config'
|
||||||
|
import viteConfig from './vite.config'
|
||||||
|
|
||||||
|
export default defineConfig(configEnv => mergeConfig(
|
||||||
|
viteConfig(configEnv),
|
||||||
|
defineConfig({
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
environment: 'jsdom',
|
||||||
|
alias: {
|
||||||
|
"\\.css$": "identity-obj-proxy",
|
||||||
|
"\\.svg\\?react$": "<rootDir>/test/mocks/svgr.ts",
|
||||||
|
"^\\./IndexedDBWorker\\?worker$": "<rootDir>/test/mocks/workerMock.ts",
|
||||||
|
"^\\./olm$": "<rootDir>/test/mocks/olmMock.ts"
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
modules: {
|
||||||
|
classNameStrategy: 'non-scoped'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
"test/**/*-test.[jt]s?(x)"
|
||||||
|
],
|
||||||
|
coverage: {
|
||||||
|
reporter: ['text', 'html'],
|
||||||
|
exclude: [
|
||||||
|
'node_modules/'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})))
|
||||||
Reference in New Issue
Block a user