forked from eemeli/yaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.js
More file actions
42 lines (40 loc) · 1.01 KB
/
vitest.config.js
File metadata and controls
42 lines (40 loc) · 1.01 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
import { resolve } from 'node:path'
import { env } from 'node:process'
import { defineConfig } from 'vitest/config'
let alias
if (env.TEST_DIST || env.npm_lifecycle_event === 'test:dist') {
console.log('Testing build output from dist/')
alias = [
{
find: /^yaml/,
/** @param {string} path */
customResolver(path) {
const name = path.split('/')[1] ?? 'index'
return resolve(import.meta.dirname, 'dist', `${name}.js`)
}
},
{
find: '../src/test-events.ts',
replacement: resolve(import.meta.dirname, 'dist', 'test-events.js')
}
]
} else {
alias = [
{
find: /^yaml/,
/** @param {string} path */
customResolver(path) {
const name = path.split('/')[1] ?? 'index'
return resolve(import.meta.dirname, 'src', `${name}.ts`)
}
}
]
}
export default defineConfig({
test: {
alias,
globals: true,
include: ['tests/**/*.{js,ts}'],
exclude: ['tests/_*', 'tests/artifacts/', 'tests/json-test-suite/']
}
})