-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvitest.config.ts
More file actions
72 lines (67 loc) · 1.68 KB
/
vitest.config.ts
File metadata and controls
72 lines (67 loc) · 1.68 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
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
const endoifySourcePath = path.join(
import.meta.dirname,
'./packages/kernel-shims/src/endoify.js',
);
export default defineConfig({
optimizeDeps: {
exclude: ['@sqlite.org/sqlite-wasm'],
include: ['@vitest/coverage-v8', 'vitest-fetch-mock', 'better-sqlite3'],
},
plugins: [
// Redirect @metamask/kernel-shims/endoify to the source file and mark it
// external so it is not bundled into the test runner.
{
name: 'kernel-shims-endoify-resolver',
enforce: 'pre',
resolveId(id) {
if (id === '@metamask/kernel-shims/endoify') {
return { id: endoifySourcePath, external: true };
}
return undefined;
},
},
],
resolve: {
// Resolve imports using the "paths" property of the relevant tsconfig.json.
tsconfigPaths: true,
},
test: {
environment: 'node',
pool: 'threads',
projects: ['packages/*'],
silent: true,
testTimeout: 2000,
restoreMocks: true,
clearMocks: true,
reporters: [
[
'default',
{
summary: false,
},
],
],
setupFiles: [
fileURLToPath(
import.meta.resolve('@ocap/repo-tools/test-utils/fetch-mock'),
),
],
coverage: {
enabled: true,
provider: 'v8',
reporter: ['json', 'json-summary', 'html'],
reportsDirectory: './coverage',
include: ['**/src/**/*.{ts,tsx}'],
exclude: [
'**/coverage/**',
'**/dist/**',
'**/test/**',
'**/node_modules/**',
'**/*.{test,spec}.{ts,tsx,js,jsx}',
],
},
},
});