-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.js
More file actions
45 lines (41 loc) · 1.23 KB
/
vitest.config.js
File metadata and controls
45 lines (41 loc) · 1.23 KB
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
/*!
* Copyright (c) 2024, Rahul Gupta and Multipart Fetch contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
import { configDefaults, defineConfig } from "vitest/config";
import parseGitignore from "parse-gitignore";
import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const gitignorePath = resolve(__dirname, ".gitignore");
const gitignorePatterns = parseGitignore(
readFileSync(gitignorePath, "utf-8"),
).patterns.map((pattern) => `**/${pattern}`);
function resolvePath(path) {
return resolve(__dirname, path);
}
export default defineConfig({
resolve: {
alias: {
"~": resolvePath("src"),
},
},
test: {
exclude: [...configDefaults.exclude, ...gitignorePatterns],
coverage: {
include: ["src/"],
exclude: [
...configDefaults.coverage.exclude,
...gitignorePatterns,
"src/index.js",
],
},
},
});