@theholocron/vitest-config 5.1.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/library.js +22 -5
- package/package.json +1 -1
package/bundles/library.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
1
2
|
import { node } from "../presets/node.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Vitest bundle for published Node.js libraries.
|
|
5
6
|
* Includes coverage with an 80% threshold on all metrics.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* Accepts per-file threshold overrides via `thresholds` in options:
|
|
9
|
+
*
|
|
10
|
+
* ```js
|
|
11
|
+
* library({ thresholds: { "src/generated.ts": { lines: 0, functions: 0, branches: 0, statements: 0 } } })
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param {{ thresholds?: import('vitest/config').CoverageV8Options['thresholds'], [key: string]: unknown }} [options]
|
|
8
15
|
* @returns {import('vitest/config').UserProjectConfig}
|
|
9
16
|
*/
|
|
10
|
-
export function library(
|
|
11
|
-
const base = node(
|
|
17
|
+
export function library({ thresholds: thresholdOverrides, ...rest } = {}) {
|
|
18
|
+
const base = node(rest);
|
|
12
19
|
|
|
13
20
|
return {
|
|
14
21
|
...base,
|
|
@@ -16,15 +23,25 @@ export function library(options = {}) {
|
|
|
16
23
|
...base.test,
|
|
17
24
|
coverage: {
|
|
18
25
|
provider: "v8",
|
|
19
|
-
include: ["src
|
|
20
|
-
exclude: [
|
|
26
|
+
include: ["src/**/*.ts"],
|
|
27
|
+
exclude: [
|
|
28
|
+
"src/**/__tests__/**",
|
|
29
|
+
"src/**/*.{test,spec}.ts",
|
|
30
|
+
"src/index.ts",
|
|
31
|
+
"**/node_modules/**",
|
|
32
|
+
"**/dist/**",
|
|
33
|
+
],
|
|
21
34
|
thresholds: {
|
|
22
35
|
lines: 80,
|
|
23
36
|
branches: 80,
|
|
24
37
|
functions: 80,
|
|
25
38
|
statements: 80,
|
|
39
|
+
...thresholdOverrides,
|
|
26
40
|
},
|
|
27
41
|
},
|
|
28
42
|
},
|
|
29
43
|
};
|
|
30
44
|
}
|
|
45
|
+
|
|
46
|
+
/** Ready-to-use config for packages that need no customisation. */
|
|
47
|
+
export default defineConfig(library());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/vitest-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Vitest configuration presets for libraries, React apps, and Storybook within the Galaxy.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/vitest-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|