forked from yusufipk/OpenFrame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
59 lines (58 loc) · 2 KB
/
Copy pathvitest.config.ts
File metadata and controls
59 lines (58 loc) · 2 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
export default defineConfig({
// Vite 8 resolves the tsconfig `paths` (the `@/` alias) itself. The
// vite-tsconfig-paths plugin that used to do this printed a deprecation notice on
// every run.
resolve: { tsconfigPaths: true },
test: {
server: {
deps: {
// Anything reaching lib/auth.ts pulls in next-auth, whose lib/env.js imports
// the extensionless specifier 'next/server'. Node's ESM resolver cannot
// resolve that, so the module has to go through Vite's resolver instead of
// being externalised. Bun resolves it either way, which is why this is easy
// to miss: the containers used locally have no node at all, so vitest runs
// under bun there, while on a GitHub runner the vitest bin's
// `#!/usr/bin/env node` shebang wins and every suite that touches auth dies
// with ERR_MODULE_NOT_FOUND. Declared at the root so all three projects
// inherit it through `extends: true`.
inline: [/next-auth/],
},
},
projects: [
{
extends: true,
test: {
name: 'unit',
environment: 'node',
include: ['tests/unit/**/*.test.ts'],
setupFiles: ['tests/setup/unit.ts'],
},
},
{
extends: true,
test: {
name: 'api',
environment: 'node',
include: ['tests/api/**/*.test.ts'],
setupFiles: ['tests/setup/api.ts'],
globalSetup: ['tests/setup/db-global.ts'],
// One shared test database; parallel files would fight over TRUNCATE.
fileParallelism: false,
testTimeout: 20_000,
},
},
{
extends: true,
plugins: [react()],
test: {
name: 'component',
environment: 'jsdom',
include: ['tests/component/**/*.test.{ts,tsx}'],
setupFiles: ['tests/setup/component.ts'],
},
},
],
},
});