forked from solana-foundation/explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.mts
More file actions
119 lines (114 loc) · 4.26 KB
/
vite.config.mts
File metadata and controls
119 lines (114 loc) · 4.26 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import react from '@vitejs/plugin-react';
import path from 'path';
import { fileURLToPath } from 'node:url';
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
import { defineConfig } from 'vitest/config';
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
const specWorkspace = (name = 'specs') => ({
environment: 'jsdom',
globals: true,
name,
server: {
deps: {
inline: [
'@noble',
'change-case',
'@react-hook/previous',
'@solana/kit',
'@solana/rpc',
'@solana/rpc-spec',
'@solana/event-target-impl',
'@solana/addresses',
],
},
},
setupFiles: ['./test-setup.ts'],
testTimeout: 10000,
});
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@/': path.resolve(__dirname, './'),
'@/app': path.resolve(__dirname, './app'),
'@/components': path.resolve(__dirname, './app/components'),
'@/providers': path.resolve(__dirname, './app/providers'),
'@/utils': path.resolve(__dirname, './app/utils'),
'@/validators': path.resolve(__dirname, './app/validators'),
// @ aliases
'@app': path.resolve(__dirname, './app'),
'@img': path.resolve(__dirname, './app/img'),
'@components': path.resolve(__dirname, './app/components'),
'@entities': path.resolve(__dirname, './app/entities'),
'@features': path.resolve(__dirname, './app/features'),
'@providers': path.resolve(__dirname, './app/providers'),
'@shared': path.resolve(__dirname, './app/components/shared'),
'@utils': path.resolve(__dirname, './app/utils'),
'@storybook-config': path.resolve(__dirname, './.storybook'),
'@validators': path.resolve(__dirname, './app/validators'),
},
conditions: ['browser', 'default'],
},
test: {
projects: [
{
extends: true,
test: {
name: 'specs',
setupFiles: ['./test-setup.specs.ts'],
},
},
{
extends: true,
optimizeDeps: {
include: [
'vite-plugin-node-polyfills/shims/buffer',
'vite-plugin-node-polyfills/shims/global',
'vite-plugin-node-polyfills/shims/process',
],
},
plugins: [
// The plugin will run tests for the stories defined in your Storybook config
// See options at: https://storybook.js.org/docs/writing-tests/test-addon#storybooktest
storybookTest({
configDir: path.join(dirname, '.storybook'),
tags: {
include: ['test'],
exclude: ['experimental'],
},
}),
],
test: {
name: 'storybook',
browser: {
enabled: true,
headless: true,
// Firefox is disabled in CI due to flaky connection timeouts
instances: process.env.CI
? [{ browser: 'chromium' }]
: [{ browser: 'chromium' }, { browser: 'firefox' }],
provider: 'playwright',
isolate: true,
connectTimeout: 30000,
},
setupFiles: ['./test-setup.ts', './.storybook/vitest.setup.ts'],
testTimeout: 15000,
hookTimeout: 30000,
retry: 1,
sequence: {
concurrent: false,
},
},
},
],
coverage: {
provider: 'v8',
},
poolOptions: {
threads: {
useAtomics: true,
},
},
...specWorkspace(),
},
});