Repository navigation
Expand file tree
/
Copy pathvitest.config.ts
More file actions
46 lines (44 loc) · 1.84 KB
/
Copy pathvitest.config.ts
File metadata and controls
46 lines (44 loc) · 1.84 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
import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';
const at = (relativePath: string) => fileURLToPath(new URL(relativePath, import.meta.url));
export default defineConfig({
resolve: {
alias: [
// Docusaurus build-time-only modules, stubbed so theme code runs under jsdom.
{ find: '@theme/Icon/Copy', replacement: at('./tests/__stubs__/ThemeIcon.tsx') },
{ find: '@theme/Icon/Success', replacement: at('./tests/__stubs__/ThemeIcon.tsx') },
{ find: '@docusaurus/useGlobalData', replacement: at('./tests/__stubs__/useGlobalData.ts') },
// Resolve the package's own entry points to src so README snippets can be
// imported in tests — a documented symbol that isn't exported then throws.
{ find: /^docusaurus-plugin-mcp-server$/, replacement: at('./src/index.ts') },
{
find: /^docusaurus-plugin-mcp-server\/adapters$/,
replacement: at('./src/adapters-entry.ts'),
},
{
find: /^docusaurus-plugin-mcp-server\/adapters\/node$/,
replacement: at('./src/adapters-node.ts'),
},
{ find: /^docusaurus-plugin-mcp-server\/theme$/, replacement: at('./src/theme/index.ts') },
],
},
test: {
include: ['tests/**/*-test.{ts,tsx}', 'tests/**/*.test.{ts,tsx}'],
environment: 'node',
globals: true,
// Print a test's console output only when it fails. Passing tests that
// build an index or trigger an error on purpose stay quiet.
silent: 'passed-only',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.d.ts', 'src/index.ts', 'src/adapters-entry.ts', 'src/adapters-node.ts'],
thresholds: {
lines: 50,
'src/adapters/**': { lines: 85, functions: 90 },
'src/mcp/**': { lines: 70 },
},
},
},
});