@theholocron/vitest-config 4.1.0 → 4.2.2

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.
Files changed (2) hide show
  1. package/README.md +74 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Vitest Config
2
+
3
+ A [Vitest configuration](https://vitest.dev/config/) with presets for Node.js libraries, React apps, and Storybook within the Galaxy.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install --save-dev @theholocron/vitest-config
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Pick the preset that matches your project type. Presets return a `UserProjectConfig` object for use in `vitest.config.js`.
14
+
15
+ ### Node.js library or CLI tool
16
+
17
+ ```javascript
18
+ import { defineConfig } from "vitest/config";
19
+ import { node } from "@theholocron/vitest-config/node";
20
+
21
+ export default defineConfig({ test: node().test });
22
+ ```
23
+
24
+ ### React component library or app
25
+
26
+ Requires `jsdom` and `@testing-library/react` as peer dependencies.
27
+
28
+ ```javascript
29
+ import { defineConfig } from "vitest/config";
30
+ import { react } from "@theholocron/vitest-config/react";
31
+
32
+ export default defineConfig({ test: react().test });
33
+ ```
34
+
35
+ ### Storybook component tests
36
+
37
+ Requires `@storybook/addon-vitest` and `playwright` as peer dependencies.
38
+
39
+ ```javascript
40
+ import { defineConfig } from "vitest/config";
41
+ import { storybook } from "@theholocron/vitest-config/storybook";
42
+
43
+ export default defineConfig(await storybook(".storybook"));
44
+ ```
45
+
46
+ ## Bundles
47
+
48
+ Bundles combine a preset with opinionated coverage settings (80% threshold on all metrics via `@vitest/coverage-v8`).
49
+
50
+ ### Library bundle
51
+
52
+ ```javascript
53
+ import { defineConfig } from "vitest/config";
54
+ import { library } from "@theholocron/vitest-config/bundles/library";
55
+
56
+ export default defineConfig({ test: library().test });
57
+ ```
58
+
59
+ ### React app bundle
60
+
61
+ ```javascript
62
+ import { defineConfig } from "vitest/config";
63
+ import { reactApp } from "@theholocron/vitest-config/bundles/react-app";
64
+
65
+ export default defineConfig({ test: reactApp().test });
66
+ ```
67
+
68
+ ## How We Test
69
+
70
+ We use [Vitest](https://vitest.dev/) as our testing framework with the following conventions:
71
+
72
+ - **Coverage**: enforced at 80% on lines, branches, functions, and statements via `@vitest/coverage-v8`
73
+ - **File naming**: test files use the `.test.{js,ts}` or `.spec.{js,ts}` suffix, co-located with source
74
+ - **Stories excluded**: `*.{story,stories}.*` files are excluded from unit test runs; use the `storybook` preset for those
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/vitest-config",
3
- "version": "4.1.0",
3
+ "version": "4.2.2",
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",