-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
67 lines (63 loc) · 2.25 KB
/
Copy pathvitest.config.ts
File metadata and controls
67 lines (63 loc) · 2.25 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { ViteUserConfig, configDefaults, defineConfig } from 'vitest/config'
import path from 'node:path'
import { pathToFileURL } from 'node:url'
import swc from 'unplugin-swc'
export default defineConfig({
plugins: [
swc.vite({
jsc: {
parser: {
syntax: 'typescript',
decorators: true,
},
transform: {
decoratorMetadata: true,
legacyDecorator: true,
},
target: 'es2021',
},
}) as never,
],
resolve: {
alias: [
{
find: /^@arkstack\/([^/]+)\/(.+)$/,
replacement: path.resolve(__dirname, 'packages') + '/$1/src/$2',
},
{
find: /^@arkstack\/([^/]+)$/,
replacement: path.resolve(__dirname, 'packages') + '/$1/src/index.ts',
},
{
find: /^@app\/models\/([^/]+)$/,
replacement: '$1',
customResolver(source, importer) {
const pkgRoot = (importer ?? '').split('/src/').at(0)!
return path.resolve(pkgRoot, 'src/Contracts', `${source}.ts`)
},
},
],
tsconfigPaths: true,
} as ViteUserConfig['resolve'],
test: {
// setup file is at the root of the project, so we need to resolve it not from the current package, but from the root
setupFiles: [
path.resolve(__dirname, 'tests/setup.ts'),
pathToFileURL('testsSetup.ts').href
],
root: './',
passWithNoTests: true,
environment: 'node',
include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
exclude: [...configDefaults.exclude, 'templates/**'],
env: {
NODE_ENV: 'test',
VERBOSITY: '0'
},
coverage: {
reporter: ['text', 'json', 'html', 'lcov'],
reportsDirectory: 'coverage',
exclude: ['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*', '**/.arkstack/**'],
}
}
})