-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathvitest.edge.config.ts
29 lines (26 loc) · 1.02 KB
/
vitest.edge.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
// Run tests in the Vercel Edge Runtime, and using its resolution algorithm that
// chooses worker exports if they exist, if not it tries to look for browser exports.
import {defineConfig, mergeConfig} from 'vitest/config'
import pkg from './package.json'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
defineConfig({
test: {
environment: 'edge-runtime',
alias: {
'@sanity/client/csm': new URL(pkg.exports['./csm'].source, import.meta.url).pathname,
'@sanity/client/stega': new URL(pkg.exports['./stega'].browser.source, import.meta.url)
.pathname,
'@sanity/client': new URL(pkg.exports['.'].browser.source, import.meta.url).pathname,
},
typecheck: {
enabled: false,
},
},
resolve: {
// https://github.com/vercel/next.js/blob/95322649ffb2ad0d6423481faed188dd7b1f7ff2/packages/next/src/build/webpack-config.ts#L1079-L1084
conditions: ['edge-light', 'worker', 'browser', 'module', 'import', 'node'],
},
}),
)