(options: VitestPackageOptions = {})
| 19 | } |
| 20 | |
| 21 | export function defineVitestConfig(options: VitestPackageOptions = {}) { |
| 22 | const pkg = JSON.parse(readFileSync(path.join(process.cwd(), 'package.json'), 'utf8')); |
| 23 | const reporters = |
| 24 | process.env.GITHUB_ACTIONS === 'true' |
| 25 | ? ['default', 'github-actions', new SummaryLabelReporter(pkg.name)] |
| 26 | : ['default']; |
| 27 | return defineConfig({ |
| 28 | resolve: { |
| 29 | tsconfigPaths: true, |
| 30 | alias: buildTsconfigAliases(process.cwd()) |
| 31 | }, |
| 32 | test: { |
| 33 | include: ['test/**/*.test.ts'], |
| 34 | testTimeout: options.testTimeout ?? 30000, |
| 35 | setupFiles: options.setupFiles, |
| 36 | passWithNoTests: true, |
| 37 | chaiConfig: options.truncateThreshold !== undefined |
| 38 | ? { truncateThreshold: options.truncateThreshold } |
| 39 | : undefined, |
| 40 | reporters |
| 41 | } |
| 42 | }); |
| 43 | } |
no test coverage detected