forked from pingdotgg/uploadthing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.ts
30 lines (27 loc) · 872 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
import { existsSync, readdirSync } from "fs";
import { defineConfig } from "vitest/config";
const pkgRoot = (pkg: string) =>
new URL(`./packages/${pkg}`, import.meta.url).pathname;
const alias = (pkg: string) => `${pkgRoot(pkg)}/src`;
const aliases = readdirSync(new URL("./packages", import.meta.url).pathname)
.filter((dir) => existsSync(pkgRoot(dir) + "/package.json"))
.filter((dir) => dir !== "uploadthing")
.reduce<Record<string, string>>(
(acc, pkg) => {
acc[`@uploadthing/${pkg}`] = alias(pkg);
return acc;
},
{ uploadthing: alias("uploadthing") },
);
export default defineConfig({
test: {
mockReset: true,
coverage: {
provider: "v8",
include: ["**/src/**"],
exclude: ["**/docs/**", "**/examples/**", "**/tooling/**"],
},
},
esbuild: { target: "es2020" },
resolve: { alias: aliases },
});