-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.workspace.ts
39 lines (36 loc) · 989 Bytes
/
vitest.workspace.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
32
33
34
35
36
37
38
39
import { defineWorkspace } from "vitest/config";
const usePackage = ({
namespace,
id,
type,
}:
| {
namespace?: undefined;
id: string;
type: "apps";
}
| {
namespace: string;
id: string;
type: "packages";
}) => {
const dir =
type === "packages" ? `${type}/${namespace}/${id}` : `${type}/${id}`;
const name = type === "packages" ? `${namespace}/${id}` : id;
return {
test: {
include: [`${dir}/test/**/*.spec.ts`],
exclude: [],
name,
environment: "node",
alias: {
[`@${name}`]: new URL(`${dir}/src`, import.meta.url).pathname,
},
},
};
};
export default defineWorkspace([
usePackage({ namespace: "shared", id: "utils", type: "packages" }),
usePackage({ namespace: "test", id: "utils", type: "packages" }),
usePackage({ id: "eisenhower", type: "apps" }),
]);