-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Expand file tree
/
Copy pathvitest.config.mts
More file actions
65 lines (64 loc) · 2.16 KB
/
Copy pathvitest.config.mts
File metadata and controls
65 lines (64 loc) · 2.16 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
import { resolve } from 'path';
import { defineConfig } from 'vitest/config';
import { getTestMaxWorkers } from './test/vitestWorkers';
export default defineConfig({
resolve: {
alias: {
'@': resolve('projects/app/src'),
'@fastgpt-sdk/storage': resolve('sdk/storage/src/index.ts'),
'@fastgpt-sdk/otel/logger': resolve('sdk/otel/src/logger-entry.ts'),
'@fastgpt-sdk/otel/metrics': resolve('sdk/otel/src/metrics-entry.ts'),
'@fastgpt-sdk/otel/tracing': resolve('sdk/otel/src/tracing-entry.ts'),
'@fastgpt-sdk/otel': resolve('sdk/otel/src/index.ts'),
'@fastgpt': resolve('packages'),
'@test': resolve('test')
}
},
test: {
env: {
FILE_TOKEN_KEY:
process.env.FILE_TOKEN_KEY ??
'bfd697e7e798f75deaf2d31210bc93a2e41ad4eed9e7831071d77821b7b97cff',
AES256_SECRET_KEY: process.env.AES256_SECRET_KEY ?? 'fastgpt_test_aes256_secret_key',
INVOKE_TOKEN_SECRET:
process.env.INVOKE_TOKEN_SECRET ?? 'fastgpt_test_invoke_token_secret_32'
},
coverage: {
enabled: true,
reporter: ['html', 'json-summary', 'json'],
// reporter: ['text', 'text-summary', 'html', 'json-summary', 'json'],
reportOnFailure: true,
include: ['projects/app/**/*.ts', 'packages/**/*.ts'],
exclude: [
'**/node_modules/**',
'**/*.spec.ts',
'**/*/*.d.ts',
'**/test/**',
'**/*.test.ts',
'**/*/constants.ts',
'**/*/*.const.ts',
'**/*/type.ts',
'**/*/types.ts',
'**/*/type/*',
'**/*/schema.ts',
'**/*/*.schema.ts',
'packages/global/openapi/**/*',
'packages/global/core/workflow/template/**/*'
],
cleanOnRerun: false
},
outputFile: 'test-results.json',
setupFiles: 'test/setup.ts',
globalSetup: 'test/globalSetup.ts',
fileParallelism: true,
maxWorkers: getTestMaxWorkers(),
// Test-level execution within a file: parallel (up to 5 concurrent tests)
maxConcurrency: 10,
pool: 'threads',
testTimeout: 20000,
hookTimeout: 30000,
passWithNoTests: true,
reporters: ['github-actions', 'default'],
include: ['test/**/*.test.ts']
}
});