-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathvitest.config.ts
70 lines (68 loc) · 1.97 KB
/
vitest.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
70
import path from 'path';
import topLevelAwait from 'vite-plugin-top-level-await';
import wasm from 'vite-plugin-wasm';
import { defineConfig, UserConfigExport } from 'vitest/config';
const config: UserConfigExport = {
server: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp'
}
},
// This is only needed for local tests to resolve the package name correctly
resolve: {
alias: {
/**
* Note that this requires the Typescript to be compiled with `tsc`
* first. This is required due to the format of Webworker URIs
* they link to `.js` files.
*/
'@powersync/web': path.resolve(__dirname, './lib/src'),
// https://jira.mongodb.org/browse/NODE-5773
bson: require.resolve('bson')
}
},
worker: {
format: 'es',
plugins: () => [wasm(), topLevelAwait()]
},
optimizeDeps: {
// Don't optimise these packages as they contain web workers and WASM files.
// https://github.com/vitejs/vite/issues/11672#issuecomment-1415820673
exclude: ['@journeyapps/wa-sqlite', '@powersync/web'],
include: ['bson']
},
plugins: [wasm(), topLevelAwait()],
test: {
globals: true,
include: ['tests/**/*.test.ts'],
maxConcurrency: 1,
// This doesn't currently seem to work in browser mode, but setting this for one day when it does
sequence: {
shuffle: false, // Disable shuffling of test files
concurrent: false // Run test files sequentially
},
browser: {
enabled: true,
/**
* Starts each test in a new iFrame
*/
isolate: true,
provider: 'playwright',
headless: true,
instances: [
{
browser: 'chromium'
}
// {
// browser: 'firefox'
// }
// This requires some additional work to get all tests passing
// {
// browser: 'webkit'
// }
]
}
}
};
export default defineConfig(config);