Repository navigation
Expand file tree
/
Copy pathvitest.config.ts
More file actions
65 lines (61 loc) · 2.02 KB
/
Copy pathvitest.config.ts
File metadata and controls
65 lines (61 loc) · 2.02 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 { playwright } from '@vitest/browser-playwright'
import solid from 'vite-plugin-solid'
import { defineConfig, type ViteUserConfig } from 'vitest/config'
const src = (file: string) => new URL(`./src/${file}`, import.meta.url).pathname
const alias = {
'solid-route-progress/router': src('router.tsx'),
'solid-route-progress/navigation': src('navigation.tsx'),
'solid-route-progress/style.css': src('style.css'),
'solid-route-progress': src('index.ts'),
}
/** The router tests again, against the oldest `@solidjs/router` line the peer range accepts. */
const router015 = { '@solidjs/router': '@solidjs/router-0.15' }
/** One project per runtime: the same source compiled for the DOM, for the server, and run in real browsers. */
const project = (
name: string,
test: ViteUserConfig['test'],
solidOptions?: Parameters<typeof solid>[0],
extraAlias?: Record<string, string>,
): ViteUserConfig => ({
plugins: [solid(solidOptions)],
resolve: { alias: { ...extraAlias, ...alias } },
test: { name, ...test },
})
export default defineConfig({
test: {
projects: [
project('dom', {
environment: 'jsdom',
setupFiles: ['./test/setup.ts'],
include: ['test/*.test.{ts,tsx}'],
}),
project('ssr', { environment: 'node', include: ['test/ssr/*.test.tsx'] }, { ssr: true }),
project(
'dom (router 0.15)',
{
environment: 'jsdom',
setupFiles: ['./test/setup.ts'],
include: ['test/router.test.tsx'],
},
undefined,
router015,
),
project(
'ssr (router 0.15)',
{ environment: 'node', include: ['test/ssr/*.test.tsx'] },
{ ssr: true },
router015,
),
project('browser', {
include: ['test/browser/*.test.tsx'],
browser: {
enabled: true,
headless: true,
screenshotFailures: false,
provider: playwright(),
instances: [{ browser: 'chromium' }, { browser: 'firefox' }, { browser: 'webkit' }],
},
}),
],
},
})