-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitest.workspace.ts
49 lines (44 loc) · 1.05 KB
/
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
40
41
42
43
44
45
46
47
48
49
/// <reference types="vitest" />
import { readdirSync } from "fs"
import { join, resolve } from "path"
import swc from "unplugin-swc"
import { defineProject, defineWorkspace } from "vitest/config"
// https://github.com/vitest-dev/vitest/issues/740#issuecomment-1254766751
// still only solution
try {
require("sharp")
} catch (error) {
//
}
const e2eApi = defineProject({
plugins: [swc.vite()],
test: {
name: "api-e2e",
include: [join("./packages/api/**/*.e2e-spec.ts")],
alias: {
[`@api`]: resolve(__dirname, `packages/api/src`),
},
clearMocks: true,
globals: false,
},
})
const folders = readdirSync("./packages").filter((f) => f !== "e2e-tests")
const unitTests = folders.map((folder) =>
defineProject({
plugins: [swc.vite()],
test: {
name: folder,
include: [join("./packages", folder, "**/*.spec.{ts,js,tsx}")],
alias: {
[`@${folder}`]: resolve(__dirname, `packages/${folder}/src`),
},
clearMocks: true,
globals: false,
// logHeapUsage: false,
},
}),
)
export default defineWorkspace([
...unitTests,
// e2eApi,
])