-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathvitest.shared.ts
More file actions
35 lines (31 loc) · 903 Bytes
/
vitest.shared.ts
File metadata and controls
35 lines (31 loc) · 903 Bytes
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
/**
* Copyright (c) Statsify
*
* This source code is licensed under the GNU GPL v3 license found in the
* LICENSE file in the root directory of this source tree.
* https://github.com/Statsify/statsify/blob/main/LICENSE
*/
import { defineConfig } from "vitest/config";
import { readFile } from "node:fs/promises";
import { swc } from "./vite.swc.js";
async function getSwcrc(path?: string) {
const config = await readFile(path ?? "./.swcrc", "utf8").then(JSON.parse);
delete config["$schema"];
return config;
}
export async function config(path?: string) {
const swcrc = await getSwcrc(path);
return defineConfig({
optimizeDeps: {
disabled: true,
},
envPrefix: "VITEST",
test: {
environment: "node",
includeSource: ["./src/**/*.ts", "./src/**/*.tsx"],
globals: false,
passWithNoTests: true,
},
plugins: [swc.vite(swcrc)],
});
}