forked from mikro-orm/mikro-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
83 lines (81 loc) · 2.8 KB
/
Copy pathvitest.config.ts
File metadata and controls
83 lines (81 loc) · 2.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
import swc from 'unplugin-swc';
const root = fileURLToPath(new URL('./packages', import.meta.url)).replace(/\\/g, '/');
export default defineConfig({
oxc: {
decorator: {
legacy: true,
emitDecoratorMetadata: true,
},
},
test: {
projects: [
{
extends: true,
test: {
name: 'legacy',
include: ['tests/**/*.test.ts'],
exclude: ['tests/features/decorators/es', 'tests/deno/**'],
},
},
{
extends: true,
// ES decorators need SWC to downlevel, oxc doesn't support this yet.
oxc: false,
plugins: [
swc.vite({
jsc: {
target: 'es2024',
parser: {
syntax: 'typescript',
decorators: true,
},
transform: {
decoratorVersion: '2022-03',
},
},
sourceMaps: true,
}),
],
test: {
name: 'es',
include: ['tests/features/decorators/es/*.test.ts'],
},
},
],
globals: true,
coverage: {
reporter: ['clover', 'json', 'lcov', 'text'],
include: ['packages/*/src/**/*.ts'],
exclude: ['packages/cli/src/cli.ts', 'packages/mikro-orm/src/index.ts'],
},
setupFiles: ['./tests/setup.ts'],
globalSetup: './tests/globalSetup.ts',
disableConsoleIntercept: true,
clearMocks: true,
isolate: false,
testTimeout: 60_000,
hookTimeout: 120_000,
alias: [
{
find: '@mikro-orm/mongo-highlighter',
replacement: new URL('/node_modules/@mikro-orm/mongo-highlighter', import.meta.url).pathname,
},
{
find: '@mikro-orm/sql-highlighter',
replacement: new URL('/node_modules/@mikro-orm/sql-highlighter', import.meta.url).pathname,
},
{ find: 'mikro-orm', replacement: `${root}/mikro-orm/src` },
{ find: '@mikro-orm/core/file-discovery', replacement: `${root}/core/src/metadata/discover-entities.ts` },
{ find: '@mikro-orm/core/fs-utils', replacement: `${root}/core/src/utils/fs-utils.ts` },
{ find: '@mikro-orm/core/migrations', replacement: `${root}/core/src/utils/AbstractMigrator.ts` },
{ find: '@mikro-orm/core/schema', replacement: `${root}/core/src/utils/AbstractSchemaGenerator.ts` },
{ find: '@mikro-orm/core/dataloader', replacement: `${root}/core/src/utils/DataloaderUtils.ts` },
{ find: '@mikro-orm/decorators/es', replacement: `${root}/decorators/src/es/index.ts` },
{ find: '@mikro-orm/decorators/legacy', replacement: `${root}/decorators/src/legacy/index.ts` },
{ find: /^@mikro-orm\/(.*)$/, replacement: `${root}/$1/src` },
],
retry: process.env.RETRY_TESTS ? 1 : 0,
},
});