forked from adazzle/react-data-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
69 lines (66 loc) · 1.71 KB
/
vite.config.ts
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
import react from '@vitejs/plugin-react';
import wyw from '@wyw-in-js/vite';
import { defineConfig } from 'vite';
import type { BrowserCommand } from 'vitest/node';
const isCI = process.env.CI === 'true';
// TODO: remove when `userEvent.pointer` is supported
const resizeColumn: BrowserCommand<[resizeBy: number]> = async (context, resizeBy) => {
const page = context.page;
const frame = await context.frame();
const resizeHandle = frame.locator('[role="columnheader"][aria-colindex="2"] div');
const { x, y } = (await resizeHandle.boundingBox())!;
await resizeHandle.hover({
position: { x: 5, y: 5 }
});
await page.mouse.down();
await page.mouse.move(x + resizeBy + 5, y);
await page.mouse.up();
};
export default defineConfig({
base: isCI ? '/react-data-grid/' : '/',
cacheDir: '.cache/vite',
build: {
emptyOutDir: true,
sourcemap: true
},
plugins: [
react({
exclude: ['./.cache/**/*'],
babel: {
babelrc: false,
configFile: false,
plugins: [['optimize-clsx', { functionNames: ['getCellClassname'] }]]
}
}),
wyw({
exclude: ['./.cache/**/*'],
preprocessor: 'none'
})
],
server: {
open: true
},
test: {
root: '.',
globals: true,
coverage: {
provider: 'istanbul',
enabled: isCI,
include: ['src/**/*.{ts,tsx}', '!src/types.ts'],
reporter: ['text', 'json']
},
testTimeout: isCI ? 10000 : 5000,
setupFiles: ['test/setup.ts'],
browser: {
enabled: true,
name: 'chromium',
provider: 'playwright',
commands: { resizeColumn },
viewport: { width: 1920, height: 1080 }
},
restoreMocks: true,
sequence: {
shuffle: true
}
}
});