forked from strands-agents/sdk-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
120 lines (117 loc) · 3.73 KB
/
vitest.config.ts
File metadata and controls
120 lines (117 loc) · 3.73 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'
import * as path from 'node:path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// Conditionally exclude bash tool from coverage on Windows
// since tests are skipped on Windows (bash not available)
const coverageExclude = ['src/**/__tests__/**', 'src/**/__fixtures__/**', 'src/vended-tools/**/__tests__/**']
if (process.platform === 'win32') {
coverageExclude.push('src/vended-tools/bash/**')
}
export default defineConfig({
test: {
unstubEnvs: true,
reporters: [
'default',
['junit', { outputFile: 'test/.artifacts/test-report/junit/report.xml', includeConsoleOutput: true }],
['json', { outputFile: 'test/.artifacts/test-report/json/report.json' }],
],
projects: [
{
test: {
include: ['src/**/__tests__/**/*.test.ts', 'src/vended-tools/**/__tests__/**/*.test.ts'],
includeSource: ['src/**/*.{js,ts}'],
name: { label: 'unit-node', color: 'green' },
typecheck: {
enabled: true,
tsconfig: 'src/tsconfig.json',
include: ['src/**/__tests__**/*.test-d.ts'],
},
},
},
{
test: {
include: ['src/**/__tests__/**/*.test.ts'],
exclude: ['src/vended-tools/file_editor/**/*.test.ts', 'src/vended-tools/bash/**/*.test.ts'],
name: { label: 'unit-browser', color: 'cyan' },
browser: {
enabled: true,
provider: playwright(),
headless: true,
screenshotDirectory: 'test/.artifacts/browser-screenshots/',
instances: [
{
browser: 'chromium',
},
],
},
},
},
{
test: {
alias: {
'$/sdk': path.resolve(__dirname, './src'),
'$/vended': path.resolve(__dirname, './src/vended-tools'),
},
include: ['test/integ/**/*.test.ts', 'test/integ/**/*.test.node.ts'],
name: { label: 'integ-node', color: 'magenta' },
testTimeout: 60 * 1000,
retry: 1,
globalSetup: './test/integ/__fixtures__/_setup-global.ts',
setupFiles: './test/integ/__fixtures__/_setup-test.ts',
sequence: {
concurrent: true,
},
},
},
{
test: {
alias: {
'$/sdk': path.resolve(__dirname, './src'),
'$/vended': path.resolve(__dirname, './src/vended-tools'),
},
include: ['test/integ/**/*.test.ts', 'test/integ/**/*.test.browser.ts'],
name: { label: 'integ-browser', color: 'yellow' },
testTimeout: 60 * 1000,
browser: {
enabled: true,
provider: playwright(),
headless: true,
screenshotDirectory: 'test/.artifacts/browser-screenshots/',
instances: [
{
browser: 'chromium',
},
],
},
globalSetup: './test/integ/__fixtures__/_setup-global.ts',
setupFiles: './test/integ/__fixtures__/_setup-test.ts',
sequence: {
concurrent: true,
},
},
},
],
typecheck: {
enabled: true,
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
reportsDirectory: 'test/.artifacts/coverage',
include: ['src/**/*.{ts,js}', 'src/vended-tools/**/*.{ts,js}'],
exclude: coverageExclude,
thresholds: {
lines: 80,
functions: 80,
branches: 80,
statements: 80,
},
},
environment: 'node',
},
define: {
'import.meta.vitest': 'undefined',
},
})