-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathvitest.config.ts
More file actions
70 lines (67 loc) · 2.04 KB
/
Copy pathvitest.config.ts
File metadata and controls
70 lines (67 loc) · 2.04 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
import {readdirSync} from 'fs';
import {resolve} from 'path';
import {defineConfig} from 'vitest/config';
const root = import.meta.dirname!;
const packageNames = readdirSync(resolve(root, 'packages'), {
withFileTypes: true,
})
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name)
.sort();
function project(name: string) {
return {
resolve: {
alias: [
// Special case: @remote-dom/core/polyfill → packages/core/source/polyfill/polyfill.ts
{
find: /^@remote-dom\/core\/polyfill$/,
replacement: resolve(
root,
'packages/core/source/polyfill/polyfill.ts',
),
},
// @remote-dom/core/receivers → packages/core/source/receivers.ts
{
find: /^@remote-dom\/([^/]+)\/(.+)$/,
replacement: resolve(root, 'packages/$1/source/$2.ts'),
},
// @remote-dom/core → packages/core/source/index.ts
{
find: /^@remote-dom\/([^/]+)$/,
replacement: resolve(root, 'packages/$1/source/index.ts'),
},
],
},
test: {
name,
include: [`packages/${name}/**/*.test.{ts,tsx}`],
},
};
}
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text-summary', 'html', 'json-summary'],
reportOnFailure: true,
include: ['packages/*/source/**/*.{ts,tsx}'],
exclude: [
'packages/**/source/**/tests/**',
'packages/**/source/**/__fixtures__/**',
'packages/**/source/**/fixtures/**',
'packages/**/source/**/*.test.{ts,tsx}',
'packages/**/source/**/*.generated.{ts,tsx}',
],
excludeAfterRemap: true,
thresholds: {
'packages/compat/source/**': {lines: 96},
'packages/core/source/**': {lines: 74},
'packages/polyfill/source/**': {lines: 68},
'packages/preact/source/**': {lines: 95},
'packages/react/source/**': {lines: 84},
'packages/signals/source/**': {lines: 87},
},
},
projects: packageNames.map(project),
},
});