-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathvitest.config.ts
More file actions
67 lines (64 loc) · 1.81 KB
/
Copy pathvitest.config.ts
File metadata and controls
67 lines (64 loc) · 1.81 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
import path from 'path';
import { defineConfig, ViteUserConfigExport } from 'vitest/config';
import { playwright } from '@vitest/browser-playwright';
const mockWebRemote = path.resolve(__dirname, './tests/mocks/MockWebRemote.ts');
const config: ViteUserConfigExport = {
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'),
// Mock WebRemote to throw 401 errors for all HTTP requests in tests
'../../db/sync/WebRemote.js': mockWebRemote,
'./sync/WebRemote.js': mockWebRemote
}
},
worker: {
format: 'es'
},
optimizeDeps: {
exclude: ['@journeyapps/wa-sqlite']
},
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
},
/**
* Starts each test in a new iFrame
*/
isolate: true,
browser: {
enabled: 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);