@storybook/addon-vitest 0.0.0-pr-32597-sha-4bc605b4 → 0.0.0-pr-32759-sha-ea80f897

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 (41) hide show
  1. package/dist/chunk-55WZLVGN.mjs +11 -0
  2. package/dist/chunk-JKRQGT2U.mjs +10 -0
  3. package/dist/index.js +6 -9
  4. package/dist/index.mjs +5 -0
  5. package/dist/manager.js +8 -958
  6. package/dist/node/coverage-reporter.d.ts +184 -0
  7. package/dist/node/coverage-reporter.js +4 -1898
  8. package/dist/node/coverage-reporter.mjs +12 -0
  9. package/dist/node/vitest.d.ts +2 -0
  10. package/dist/node/vitest.js +17 -892
  11. package/dist/node/vitest.mjs +19 -0
  12. package/dist/postinstall.js +87 -2086
  13. package/dist/preset.js +35 -615
  14. package/dist/vitest-plugin/global-setup.d.ts +6 -0
  15. package/dist/vitest-plugin/global-setup.js +6 -200
  16. package/dist/vitest-plugin/global-setup.mjs +13 -0
  17. package/dist/vitest-plugin/index.js +43 -3826
  18. package/dist/vitest-plugin/index.mjs +28 -0
  19. package/dist/vitest-plugin/setup-file.d.ts +14 -0
  20. package/dist/vitest-plugin/setup-file.js +8 -30
  21. package/dist/vitest-plugin/setup-file.mjs +9 -0
  22. package/dist/vitest-plugin/test-utils.d.ts +20 -0
  23. package/dist/vitest-plugin/test-utils.js +8 -105
  24. package/dist/vitest-plugin/test-utils.mjs +8 -0
  25. package/manager.js +1 -1
  26. package/manager.mjs +1 -0
  27. package/package.json +91 -18
  28. package/postinstall.js +1 -0
  29. package/postinstall.mjs +1 -0
  30. package/preset.js +1 -1
  31. package/preset.mjs +1 -0
  32. package/dist/_browser-chunks/chunk-JK72E6FR.js +0 -6
  33. package/dist/_browser-chunks/chunk-PMYV6BH2.js +0 -76
  34. package/dist/_node-chunks/chunk-2HPAV6GF.js +0 -98
  35. package/dist/_node-chunks/chunk-MAQGJY7P.js +0 -2574
  36. package/dist/_node-chunks/chunk-N2MLPWF6.js +0 -103
  37. package/dist/_node-chunks/chunk-TUYNCG36.js +0 -91
  38. package/dist/_node-chunks/chunk-UD3V4PK3.js +0 -37
  39. package/dist/_node-chunks/chunk-VVSEYRVS.js +0 -481
  40. package/dist/_node-chunks/chunk-WXPBOWQH.js +0 -247
  41. package/dist/_node-chunks/chunk-XPVNQSCP.js +0 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "0.0.0-pr-32597-sha-4bc605b4",
3
+ "version": "0.0.0-pr-32759-sha-ea80f897",
4
4
  "description": "Storybook Vitest addon: Blazing fast component testing using stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -30,7 +30,6 @@
30
30
  "url": "https://opencollective.com/storybook"
31
31
  },
32
32
  "license": "MIT",
33
- "type": "module",
34
33
  "imports": {
35
34
  "#manager-store": {
36
35
  "storybook": "./src/manager-store.mock.ts",
@@ -40,20 +39,46 @@
40
39
  "exports": {
41
40
  ".": {
42
41
  "types": "./dist/index.d.ts",
43
- "default": "./dist/index.js"
42
+ "import": "./dist/index.mjs",
43
+ "require": "./dist/index.js"
44
44
  },
45
- "./internal/coverage-reporter": "./dist/node/coverage-reporter.js",
46
- "./internal/global-setup": "./dist/vitest-plugin/global-setup.js",
47
- "./internal/setup-file": "./dist/vitest-plugin/setup-file.js",
48
- "./internal/test-utils": "./dist/vitest-plugin/test-utils.js",
49
- "./manager": "./dist/manager.js",
50
- "./package.json": "./package.json",
51
- "./postinstall": "./dist/postinstall.js",
52
- "./preset": "./dist/preset.js",
53
- "./vitest": "./dist/node/vitest.js",
54
45
  "./vitest-plugin": {
55
46
  "types": "./dist/vitest-plugin/index.d.ts",
56
- "default": "./dist/vitest-plugin/index.js"
47
+ "import": "./dist/vitest-plugin/index.mjs",
48
+ "require": "./dist/vitest-plugin/index.js"
49
+ },
50
+ "./internal/global-setup": {
51
+ "types": "./dist/vitest-plugin/global-setup.d.ts",
52
+ "import": "./dist/vitest-plugin/global-setup.mjs",
53
+ "require": "./dist/vitest-plugin/global-setup.js"
54
+ },
55
+ "./internal/setup-file": {
56
+ "types": "./dist/vitest-plugin/setup-file.d.ts",
57
+ "import": "./dist/vitest-plugin/setup-file.mjs"
58
+ },
59
+ "./internal/test-utils": {
60
+ "types": "./dist/vitest-plugin/test-utils.d.ts",
61
+ "import": "./dist/vitest-plugin/test-utils.mjs",
62
+ "require": "./dist/vitest-plugin/test-utils.js"
63
+ },
64
+ "./internal/coverage-reporter": {
65
+ "types": "./dist/node/coverage-reporter.d.ts",
66
+ "import": "./dist/node/coverage-reporter.mjs",
67
+ "require": "./dist/node/coverage-reporter.js"
68
+ },
69
+ "./manager": "./dist/manager.js",
70
+ "./preset": "./dist/preset.js",
71
+ "./postinstall": "./dist/postinstall.js",
72
+ "./package.json": "./package.json"
73
+ },
74
+ "main": "dist/index.js",
75
+ "module": "dist/index.mjs",
76
+ "types": "dist/index.d.ts",
77
+ "typesVersions": {
78
+ "*": {
79
+ "*": [
80
+ "dist/index.d.ts"
81
+ ]
57
82
  }
58
83
  },
59
84
  "files": [
@@ -68,12 +93,12 @@
68
93
  "!src/**/*"
69
94
  ],
70
95
  "scripts": {
71
- "check": "jiti ../../../scripts/check/check-package.ts",
72
- "prep": "jiti ../../../scripts/build/build-package.ts"
96
+ "check": "jiti ../../../scripts/prepare/check.ts",
97
+ "prep": "jiti ../../../scripts/prepare/addon-bundle.ts"
73
98
  },
74
99
  "dependencies": {
75
100
  "@storybook/global": "^5.0.0",
76
- "@storybook/icons": "^1.6.0",
101
+ "@storybook/icons": "^1.4.0",
77
102
  "prompts": "^2.4.0",
78
103
  "ts-dedent": "^2.2.0"
79
104
  },
@@ -85,9 +110,9 @@
85
110
  "@vitest/browser": "^3.2.4",
86
111
  "@vitest/runner": "^3.2.4",
87
112
  "boxen": "^8.0.1",
88
- "empathic": "^2.0.0",
89
113
  "es-toolkit": "^1.36.0",
90
114
  "execa": "^8.0.1",
115
+ "find-up": "^7.0.0",
91
116
  "istanbul-lib-report": "^3.0.1",
92
117
  "micromatch": "^4.0.8",
93
118
  "pathe": "^1.1.2",
@@ -106,7 +131,7 @@
106
131
  "peerDependencies": {
107
132
  "@vitest/browser": "^3.0.0",
108
133
  "@vitest/runner": "^3.0.0",
109
- "storybook": "^0.0.0-pr-32597-sha-4bc605b4",
134
+ "storybook": "^0.0.0-pr-32759-sha-ea80f897",
110
135
  "vitest": "^3.0.0"
111
136
  },
112
137
  "peerDependenciesMeta": {
@@ -123,6 +148,54 @@
123
148
  "publishConfig": {
124
149
  "access": "public"
125
150
  },
151
+ "bundler": {
152
+ "exportEntries": [
153
+ "./src/index.ts",
154
+ "./src/vitest-plugin/test-utils.ts",
155
+ "./src/vitest-plugin/setup-file.ts"
156
+ ],
157
+ "managerEntries": [
158
+ "./src/manager.tsx"
159
+ ],
160
+ "nodeEntries": [
161
+ "./src/preset.ts",
162
+ "./src/postinstall.ts",
163
+ {
164
+ "file": "./src/dummy.ts",
165
+ "formats": [
166
+ "esm"
167
+ ]
168
+ },
169
+ {
170
+ "file": "./src/node/vitest.ts",
171
+ "formats": [
172
+ "esm",
173
+ "cjs"
174
+ ]
175
+ },
176
+ {
177
+ "file": "./src/node/coverage-reporter.ts",
178
+ "formats": [
179
+ "esm",
180
+ "cjs"
181
+ ]
182
+ },
183
+ {
184
+ "file": "./src/vitest-plugin/index.ts",
185
+ "formats": [
186
+ "cjs",
187
+ "esm"
188
+ ]
189
+ },
190
+ {
191
+ "file": "./src/vitest-plugin/global-setup.ts",
192
+ "formats": [
193
+ "cjs",
194
+ "esm"
195
+ ]
196
+ }
197
+ ]
198
+ },
126
199
  "storybook": {
127
200
  "displayName": "Test",
128
201
  "unsupportedFrameworks": [
package/postinstall.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/postinstall');
@@ -0,0 +1 @@
1
+ export * from './dist/postinstall.mjs';
package/preset.js CHANGED
@@ -1 +1 @@
1
- export * from './dist/preset.js';
1
+ module.exports = require('./dist/preset');
package/preset.mjs ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/preset.mjs';
@@ -1,6 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- export {
5
- __name
6
- };
@@ -1,76 +0,0 @@
1
- // ../../core/src/component-testing/constants.ts
2
- var ADDON_ID = "storybook/interactions";
3
- var PANEL_ID = `${ADDON_ID}/panel`;
4
- var DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon";
5
- var DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
6
-
7
- // ../a11y/src/constants.ts
8
- var ADDON_ID2 = "storybook/a11y";
9
- var PANEL_ID2 = `${ADDON_ID2}/panel`;
10
- var RESULT = `${ADDON_ID2}/result`;
11
- var REQUEST = `${ADDON_ID2}/request`;
12
- var RUNNING = `${ADDON_ID2}/running`;
13
- var ERROR = `${ADDON_ID2}/error`;
14
- var MANUAL = `${ADDON_ID2}/manual`;
15
- var SELECT = `${ADDON_ID2}/select`;
16
- var DOCUMENTATION_LINK2 = "writing-tests/accessibility-testing";
17
- var DOCUMENTATION_DISCREPANCY_LINK2 = `${DOCUMENTATION_LINK2}#why-are-my-tests-failing-in-different-environments`;
18
-
19
- // src/constants.ts
20
- var ADDON_ID3 = "storybook/test";
21
- var TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider`;
22
- var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon";
23
- var DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK3}#what-happens-if-vitest-itself-has-an-error`;
24
- var storeOptions = {
25
- id: ADDON_ID3,
26
- initialState: {
27
- config: {
28
- coverage: false,
29
- a11y: false
30
- },
31
- watching: false,
32
- cancelling: false,
33
- fatalError: void 0,
34
- indexUrl: void 0,
35
- previewAnnotations: [],
36
- currentRun: {
37
- triggeredBy: void 0,
38
- config: {
39
- coverage: false,
40
- a11y: false
41
- },
42
- componentTestCount: {
43
- success: 0,
44
- error: 0
45
- },
46
- a11yCount: {
47
- success: 0,
48
- warning: 0,
49
- error: 0
50
- },
51
- storyIds: void 0,
52
- totalTestCount: void 0,
53
- startedAt: void 0,
54
- finishedAt: void 0,
55
- unhandledErrors: [],
56
- coverageSummary: void 0
57
- }
58
- }
59
- };
60
- var FULL_RUN_TRIGGERS = ["global", "run-all"];
61
- var STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`;
62
- var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test";
63
- var STATUS_TYPE_ID_A11Y = "storybook/a11y";
64
-
65
- export {
66
- PANEL_ID,
67
- ADDON_ID2 as ADDON_ID,
68
- PANEL_ID2,
69
- ADDON_ID3 as ADDON_ID2,
70
- TEST_PROVIDER_ID,
71
- DOCUMENTATION_FATAL_ERROR_LINK,
72
- storeOptions,
73
- FULL_RUN_TRIGGERS,
74
- STATUS_TYPE_ID_COMPONENT_TEST,
75
- STATUS_TYPE_ID_A11Y
76
- };
@@ -1,98 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_p5l39hef73f from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_p5l39hef73f from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_p5l39hef73f from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_p5l39hef73f.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_p5l39hef73f.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_p5l39hef73f.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "./chunk-XPVNQSCP.js";
15
-
16
- // src/utils.ts
17
- function getAddonNames(mainConfig) {
18
- const addons = mainConfig.addons || [];
19
- const addonList = addons.map((addon) => {
20
- let name = "";
21
- if (typeof addon === "string") {
22
- name = addon;
23
- } else if (typeof addon === "object") {
24
- name = addon.name;
25
- }
26
- return name;
27
- });
28
- return addonList.filter((item) => item != null);
29
- }
30
- __name(getAddonNames, "getAddonNames");
31
- function errorToErrorLike(error) {
32
- return {
33
- message: error.message,
34
- name: error.name,
35
- // avoid duplicating the error message in the stack trace
36
- stack: error.stack?.replace(error.message, ""),
37
- cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
38
- };
39
- }
40
- __name(errorToErrorLike, "errorToErrorLike");
41
-
42
- // ../../node_modules/empathic/find.mjs
43
- import { join as join2 } from "node:path";
44
- import { existsSync, statSync } from "node:fs";
45
-
46
- // ../../node_modules/empathic/walk.mjs
47
- import { dirname } from "node:path";
48
-
49
- // ../../node_modules/empathic/resolve.mjs
50
- import { isAbsolute, join, resolve } from "node:path";
51
- function absolute(input, root) {
52
- return isAbsolute(input) ? input : resolve(root || ".", input);
53
- }
54
- __name(absolute, "absolute");
55
-
56
- // ../../node_modules/empathic/walk.mjs
57
- function up(base, options) {
58
- let { last, cwd } = options || {};
59
- let tmp = absolute(base, cwd);
60
- let root = absolute(last || "/", cwd);
61
- let prev, arr = [];
62
- while (prev !== root) {
63
- arr.push(tmp);
64
- tmp = dirname(prev = tmp);
65
- if (tmp === prev) break;
66
- }
67
- return arr;
68
- }
69
- __name(up, "up");
70
-
71
- // ../../node_modules/empathic/find.mjs
72
- function up2(name, options) {
73
- let dir, tmp;
74
- let start = options && options.cwd || "";
75
- for (dir of up(start, options)) {
76
- tmp = join2(dir, name);
77
- if (existsSync(tmp)) return tmp;
78
- }
79
- }
80
- __name(up2, "up");
81
- function any(names, options) {
82
- let dir, start = options && options.cwd || "";
83
- let j = 0, len = names.length, tmp;
84
- for (dir of up(start, options)) {
85
- for (j = 0; j < len; j++) {
86
- tmp = join2(dir, names[j]);
87
- if (existsSync(tmp)) return tmp;
88
- }
89
- }
90
- }
91
- __name(any, "any");
92
-
93
- export {
94
- getAddonNames,
95
- errorToErrorLike,
96
- up2 as up,
97
- any
98
- };