-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathvitest.config.esm.ts
More file actions
34 lines (33 loc) · 1.17 KB
/
vitest.config.esm.ts
File metadata and controls
34 lines (33 loc) · 1.17 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
import { defineConfig } from 'vitest/config';
import path from 'path';
/**
* Vitest config for testing against the built ESM output.
* This catches CJS/ESM interop issues (like jsonpath) that don't surface
* when testing TypeScript source directly.
*
* Run with: npm run test:esm-build (after npm run build)
*/
export default defineConfig({
test: {
globals: true,
restoreMocks: true,
exclude: ['**/node_modules/**'],
server: {
deps: {
// Don't transform built ESM - test it as-is
external: [/build\/esm/]
}
}
},
resolve: {
alias: {
// Redirect source imports to built ESM output
'../../../flagsmith-engine': path.resolve(__dirname, 'build/esm/flagsmith-engine'),
'../../../../flagsmith-engine': path.resolve(__dirname, 'build/esm/flagsmith-engine'),
'../../../sdk': path.resolve(__dirname, 'build/esm/sdk'),
'../../../../sdk': path.resolve(__dirname, 'build/esm/sdk'),
'../../sdk': path.resolve(__dirname, 'build/esm/sdk'),
'../sdk': path.resolve(__dirname, 'build/esm/sdk')
}
}
});