forked from ourongxing/newsnow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.ts
31 lines (29 loc) · 883 Bytes
/
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
import { defineConfig } from "vitest/config"
import autoImport from "unplugin-auto-import/vite"
import tsconfigPath from "vite-tsconfig-paths"
import { resolveModuleExportNames } from "mlly"
const h3Exports = await resolveModuleExportNames("h3", {
url: import.meta.url,
})
export default defineConfig({
test: {
globals: true,
environment: "node",
include: ["server/**/*.test.ts", "shared/**/*.test.ts", "test/**/*.test.ts"],
},
plugins: [
tsconfigPath(),
// https://github.com/unjs/nitro/blob/v2/src/core/config/resolvers/imports.ts
autoImport({
imports: ["vitest", {
from: "h3",
imports: h3Exports.filter(n => !/^[A-Z]/.test(n) && n !== "use"),
}, {
from: "ofetch",
imports: ["$fetch", "ofetch"],
}],
dirs: ["server/utils"],
dts: "dist/.nitro/types/nitro-imports.d.ts",
}),
],
})