newsnow/vitest.config.ts

33 lines
786 B
TypeScript
Raw Normal View History

2024-10-30 15:06:21 +08:00
import { join } from "node:path"
2024-10-09 02:54:11 +08:00
import { defineConfig } from "vitest/config"
2024-10-31 01:12:44 +08:00
import unimport from "unimport/unplugin"
2024-10-30 15:06:21 +08:00
import { projectDir } from "./shared/dir"
2024-10-09 02:54:11 +08:00
export default defineConfig({
test: {
globals: true,
environment: "node",
2024-10-12 15:50:44 +08:00
include: ["server/**/*.test.ts", "shared/**/*.test.ts", "test/**/*.test.ts"],
2024-10-09 02:54:11 +08:00
},
2024-10-30 15:06:21 +08:00
resolve: {
alias: {
"@shared": join(projectDir, "shared"),
"#": join(projectDir, "server"),
},
},
2024-10-09 02:54:11 +08:00
plugins: [
// https://github.com/unjs/nitro/blob/v2/src/core/config/resolvers/imports.ts
2024-10-31 01:12:44 +08:00
unimport.vite({
imports: [],
presets: [
{
package: "h3",
ignore: [/^[A-Z]/, r => r === "use"],
},
],
2024-10-30 15:06:21 +08:00
dirs: ["server/utils", "shared"],
2024-10-31 01:12:44 +08:00
// dts: false,
2024-10-09 02:54:11 +08:00
}),
],
})