-
Notifications
You must be signed in to change notification settings - Fork 255
/
vitest.config.ts
45 lines (44 loc) · 1.03 KB
/
vitest.config.ts
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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'url';
import fs from 'fs/promises';
export default defineConfig({
esbuild: {
exclude: [],
include: /(src|__tests__)\/.*\.jsx?$/,
loader: 'jsx',
},
optimizeDeps: {
esbuildOptions: {
plugins: [
{
name: 'load-js-files-as-jsx',
/** */
setup(build) {
build.onLoad({ filter: /(src|__tests__)\/.*\.js$/ }, async (args) => ({
contents: await fs.readFile(args.path, 'utf8'),
loader: 'jsx',
}));
},
},
],
},
},
plugins: [react()],
resolve: {
alias: {
'@tests': fileURLToPath(new URL('./__tests__', import.meta.url)),
},
},
test: {
environment: 'happy-dom',
exclude: ['node_modules'],
globals: true,
include: ['**/*.test.js', '**/*.test.jsx'],
sequence: {
shuffle: true,
},
setupFiles: ['./setupTest.js'],
},
});