@storybook/addon-vitest 10.2.0-alpha.9 → 10.2.0-beta.1

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.
@@ -1,5 +1,6 @@
1
1
  // ../../core/src/component-testing/constants.ts
2
- var ADDON_ID = "storybook/interactions", PANEL_ID = `${ADDON_ID}/panel`, DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
2
+ var ADDON_ID = "storybook/interactions", PANEL_ID = `${ADDON_ID}/panel`;
3
+ var DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
3
4
 
4
5
  // ../a11y/src/constants.ts
5
6
  var ADDON_ID2 = "storybook/a11y", PANEL_ID2 = `${ADDON_ID2}/panel`;
@@ -1,17 +1,18 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
 
13
13
  // ../../core/src/component-testing/constants.ts
14
- var ADDON_ID = "storybook/interactions", PANEL_ID = `${ADDON_ID}/panel`, DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
14
+ var ADDON_ID = "storybook/interactions", PANEL_ID = `${ADDON_ID}/panel`;
15
+ var DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-there-are-different-test-results-in-multiple-environments`;
15
16
 
16
17
  // ../a11y/src/constants.ts
17
18
  var ADDON_ID2 = "storybook/a11y", PANEL_ID2 = `${ADDON_ID2}/panel`;
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __commonJS
14
- } from "./chunk-BHP6UQBM.js";
14
+ } from "./chunk-YEIHTRUF.js";
15
15
 
16
16
  // ../../../node_modules/semver/internal/constants.js
17
17
  var require_constants = __commonJS({
@@ -1,23 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  ADDON_ID
14
- } from "./chunk-QZKT5ZP5.js";
14
+ } from "./chunk-3K6GN7YH.js";
15
15
  import {
16
16
  require_picocolors
17
- } from "./chunk-ITLWVDM3.js";
17
+ } from "./chunk-NCM6J4H5.js";
18
18
  import {
19
19
  __toESM
20
- } from "./chunk-BHP6UQBM.js";
20
+ } from "./chunk-YEIHTRUF.js";
21
21
 
22
22
  // src/logger.ts
23
23
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __commonJS
14
- } from "./chunk-BHP6UQBM.js";
14
+ } from "./chunk-YEIHTRUF.js";
15
15
 
16
16
  // ../../../node_modules/picocolors/picocolors.js
17
17
  var require_picocolors = __commonJS({
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __commonJS
14
- } from "./chunk-BHP6UQBM.js";
14
+ } from "./chunk-YEIHTRUF.js";
15
15
 
16
16
  // ../../../node_modules/ts-dedent/dist/index.js
17
17
  var require_dist = __commonJS({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
12
12
  import {
13
13
  dirname,
14
14
  join
15
- } from "./chunk-V7JZVKO2.js";
15
+ } from "./chunk-GOQHVJWY.js";
16
16
 
17
17
  // ../../core/src/shared/utils/module.ts
18
18
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/manager.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  STORYBOOK_ADDON_TEST_CHANNEL,
11
11
  TEST_PROVIDER_ID,
12
12
  storeOptions
13
- } from "./_browser-chunks/chunk-TJXI7EIW.js";
13
+ } from "./_browser-chunks/chunk-QHH5JRC6.js";
14
14
 
15
15
  // src/manager.tsx
16
16
  import React5, { useState as useState3 } from "react";
@@ -28,7 +28,7 @@ var store = experimental_UniversalStore.create({
28
28
  }), componentTestStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST), a11yStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_A11Y), testProviderStore = experimental_getTestProviderStore(ADDON_ID2);
29
29
 
30
30
  // src/manager.tsx
31
- import { addons as addons2 } from "storybook/manager-api";
31
+ import { Tag, addons as addons2 } from "storybook/manager-api";
32
32
 
33
33
  // src/components/GlobalErrorModal.tsx
34
34
  import React, { useContext } from "react";
@@ -695,7 +695,7 @@ addons2.register(ADDON_ID2, (api) => {
695
695
  }
696
696
  ));
697
697
  },
698
- sidebarContextMenu: ({ context }) => context.type === "docs" || context.type === "story" && !context.tags.includes("test") ? null : React5.createElement(SidebarContextMenu, { context, api })
698
+ sidebarContextMenu: ({ context }) => context.type === "docs" || context.type === "story" && !context.tags.includes(Tag.TEST) ? null : React5.createElement(SidebarContextMenu, { context, api })
699
699
  });
700
700
  }
701
701
  });
@@ -1,22 +1,22 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  require_gte
14
- } from "../_node-chunks/chunk-FOEMZQXX.js";
14
+ } from "../_node-chunks/chunk-C2HYK6HS.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __require,
18
18
  __toESM
19
- } from "../_node-chunks/chunk-BHP6UQBM.js";
19
+ } from "../_node-chunks/chunk-YEIHTRUF.js";
20
20
 
21
21
  // ../../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
22
22
  var require_make_dir = __commonJS({
@@ -1,35 +1,35 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  log
14
- } from "../_node-chunks/chunk-7QM37EII.js";
14
+ } from "../_node-chunks/chunk-FPUVXKEJ.js";
15
15
  import {
16
16
  any
17
- } from "../_node-chunks/chunk-RWDHIWDU.js";
17
+ } from "../_node-chunks/chunk-BXIANBDU.js";
18
18
  import {
19
19
  ADDON_ID,
20
20
  COVERAGE_DIRECTORY,
21
21
  STATUS_TYPE_ID_A11Y,
22
22
  STATUS_TYPE_ID_COMPONENT_TEST,
23
23
  storeOptions
24
- } from "../_node-chunks/chunk-QZKT5ZP5.js";
25
- import "../_node-chunks/chunk-ITLWVDM3.js";
24
+ } from "../_node-chunks/chunk-3K6GN7YH.js";
25
+ import "../_node-chunks/chunk-NCM6J4H5.js";
26
26
  import {
27
27
  dirname,
28
28
  join,
29
29
  normalize,
30
30
  path
31
- } from "../_node-chunks/chunk-V7JZVKO2.js";
32
- import "../_node-chunks/chunk-BHP6UQBM.js";
31
+ } from "../_node-chunks/chunk-GOQHVJWY.js";
32
+ import "../_node-chunks/chunk-YEIHTRUF.js";
33
33
 
34
34
  // src/node/vitest.ts
35
35
  import process2 from "node:process";
@@ -55,7 +55,7 @@ function debounce(func, debounceMs, { signal, edges } = {}) {
55
55
  }, cancel = () => {
56
56
  cancelTimer(), pendingThis = void 0, pendingArgs = null;
57
57
  }, flush = () => {
58
- cancelTimer(), invoke();
58
+ invoke();
59
59
  }, debounced = function(...args) {
60
60
  if (signal?.aborted)
61
61
  return;
@@ -99,8 +99,14 @@ var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
99
99
 
100
100
  // ../../../node_modules/es-toolkit/dist/function/throttle.mjs
101
101
  function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) {
102
- let pendingAt = null, debounced = debounce(func, throttleMs, { signal, edges }), throttled = function(...args) {
103
- pendingAt == null ? pendingAt = Date.now() : Date.now() - pendingAt >= throttleMs && (pendingAt = Date.now(), debounced.cancel()), debounced(...args);
102
+ let pendingAt = null, debounced = debounce(function(...args) {
103
+ pendingAt = Date.now(), func.apply(this, args);
104
+ }, throttleMs, { signal, edges }), throttled = function(...args) {
105
+ if (pendingAt == null && (pendingAt = Date.now()), Date.now() - pendingAt >= throttleMs) {
106
+ pendingAt = Date.now(), func.apply(this, args), debounced.cancel(), debounced.schedule();
107
+ return;
108
+ }
109
+ debounced.apply(this, args);
104
110
  };
105
111
  return throttled.cancel = debounced.cancel, throttled.flush = debounced.flush, throttled;
106
112
  }
@@ -119,6 +125,7 @@ function errorToErrorLike(error) {
119
125
  // src/node/vitest-manager.ts
120
126
  import { existsSync } from "node:fs";
121
127
  import { getProjectRoot, resolvePathInStorybookCache } from "storybook/internal/common";
128
+ import { Tag } from "storybook/internal/core-server";
122
129
 
123
130
  // ../../../node_modules/slash/index.js
124
131
  function slash(path2) {
@@ -277,7 +284,7 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
277
284
  storiesByImportPath[absoluteImportPath] || (storiesByImportPath[absoluteImportPath] = []), storiesByImportPath[absoluteImportPath].push(story);
278
285
  }
279
286
  for (let testSpecification of testSpecifications) {
280
- let { env = {} } = testSpecification.project.config, include = env.__VITEST_INCLUDE_TAGS__?.split(",").filter(Boolean) ?? ["test"], exclude = env.__VITEST_EXCLUDE_TAGS__?.split(",").filter(Boolean) ?? [], skip = env.__VITEST_SKIP_TAGS__?.split(",").filter(Boolean) ?? [], filteredStories = (storiesByImportPath[testSpecification.moduleId] ?? []).filter((story) => !(include.length && !include.some((tag) => story.tags?.includes(tag)) || exclude.some((tag) => story.tags?.includes(tag))));
287
+ let { env = {} } = testSpecification.project.config, include = env.__VITEST_INCLUDE_TAGS__?.split(",").filter(Boolean) ?? [Tag.TEST], exclude = env.__VITEST_EXCLUDE_TAGS__?.split(",").filter(Boolean) ?? [], skip = env.__VITEST_SKIP_TAGS__?.split(",").filter(Boolean) ?? [], filteredStories = (storiesByImportPath[testSpecification.moduleId] ?? []).filter((story) => !(include.length && !include.some((tag) => story.tags?.includes(tag)) || exclude.some((tag) => story.tags?.includes(tag))));
281
288
  filteredStories.length && (this.testManager.store.getState().watching || this.updateLastChanged(testSpecification.moduleId), filteredTestSpecifications.push(testSpecification), filteredStoryIds.push(
282
289
  ...filteredStories.filter((story) => !skip.some((tag) => story.tags?.includes(tag))).map((story) => story.id)
283
290
  ));
@@ -1,32 +1,32 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  resolvePackageDir
14
- } from "./_node-chunks/chunk-U43ZWEJJ.js";
14
+ } from "./_node-chunks/chunk-WPAXFGLJ.js";
15
15
  import {
16
16
  any
17
- } from "./_node-chunks/chunk-RWDHIWDU.js";
17
+ } from "./_node-chunks/chunk-BXIANBDU.js";
18
18
  import {
19
19
  DOCUMENTATION_LINK
20
- } from "./_node-chunks/chunk-QZKT5ZP5.js";
20
+ } from "./_node-chunks/chunk-3K6GN7YH.js";
21
21
  import {
22
22
  require_dist
23
- } from "./_node-chunks/chunk-QBJ4OELT.js";
23
+ } from "./_node-chunks/chunk-OXGGGOR4.js";
24
24
  import {
25
25
  dirname,
26
26
  join,
27
27
  relative,
28
28
  resolve
29
- } from "./_node-chunks/chunk-V7JZVKO2.js";
29
+ } from "./_node-chunks/chunk-GOQHVJWY.js";
30
30
  import {
31
31
  require_compare,
32
32
  require_constants,
@@ -36,11 +36,11 @@ import {
36
36
  require_parse_options,
37
37
  require_re,
38
38
  require_semver
39
- } from "./_node-chunks/chunk-FOEMZQXX.js";
39
+ } from "./_node-chunks/chunk-C2HYK6HS.js";
40
40
  import {
41
41
  __commonJS,
42
42
  __toESM
43
- } from "./_node-chunks/chunk-BHP6UQBM.js";
43
+ } from "./_node-chunks/chunk-YEIHTRUF.js";
44
44
 
45
45
  // ../../../node_modules/semver/functions/parse.js
46
46
  var require_parse = __commonJS({
@@ -294,7 +294,7 @@ var require_cmp = __commonJS({
294
294
  var require_coerce = __commonJS({
295
295
  "../../../node_modules/semver/functions/coerce.js"(exports, module) {
296
296
  "use strict";
297
- var SemVer = require_semver(), parse = require_parse(), { safeRe: re, t } = require_re(), coerce = (version, options) => {
297
+ var SemVer = require_semver(), parse = require_parse(), { safeRe: re, t } = require_re(), coerce2 = (version, options) => {
298
298
  if (version instanceof SemVer)
299
299
  return version;
300
300
  if (typeof version == "number" && (version = String(version)), typeof version != "string")
@@ -314,7 +314,7 @@ var require_coerce = __commonJS({
314
314
  let major = match[2], minor = match[3] || "0", patch = match[4] || "0", prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "", build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
315
315
  return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
316
316
  };
317
- module.exports = coerce;
317
+ module.exports = coerce2;
318
318
  }
319
319
  });
320
320
 
@@ -819,7 +819,7 @@ var require_subset = __commonJS({
819
819
  var require_semver2 = __commonJS({
820
820
  "../../../node_modules/semver/index.js"(exports, module) {
821
821
  "use strict";
822
- var internalRe = require_re(), constants = require_constants(), SemVer = require_semver(), identifiers = require_identifiers(), parse = require_parse(), valid = require_valid(), clean = require_clean(), inc = require_inc(), diff = require_diff(), major = require_major(), minor = require_minor(), patch = require_patch(), prerelease = require_prerelease(), compare = require_compare(), rcompare = require_rcompare(), compareLoose = require_compare_loose(), compareBuild = require_compare_build(), sort = require_sort(), rsort = require_rsort(), gt = require_gt(), lt = require_lt(), eq = require_eq(), neq = require_neq(), gte = require_gte(), lte = require_lte(), cmp = require_cmp(), coerce = require_coerce(), Comparator = require_comparator(), Range = require_range(), satisfies2 = require_satisfies(), toComparators = require_to_comparators(), maxSatisfying = require_max_satisfying(), minSatisfying = require_min_satisfying(), minVersion = require_min_version(), validRange = require_valid2(), outside = require_outside(), gtr = require_gtr(), ltr = require_ltr(), intersects = require_intersects(), simplifyRange = require_simplify(), subset = require_subset();
822
+ var internalRe = require_re(), constants = require_constants(), SemVer = require_semver(), identifiers = require_identifiers(), parse = require_parse(), valid = require_valid(), clean = require_clean(), inc = require_inc(), diff = require_diff(), major = require_major(), minor = require_minor(), patch = require_patch(), prerelease = require_prerelease(), compare = require_compare(), rcompare = require_rcompare(), compareLoose = require_compare_loose(), compareBuild = require_compare_build(), sort = require_sort(), rsort = require_rsort(), gt = require_gt(), lt = require_lt(), eq = require_eq(), neq = require_neq(), gte = require_gte(), lte = require_lte(), cmp = require_cmp(), coerce2 = require_coerce(), Comparator = require_comparator(), Range = require_range(), satisfies2 = require_satisfies(), toComparators = require_to_comparators(), maxSatisfying = require_max_satisfying(), minSatisfying = require_min_satisfying(), minVersion = require_min_version(), validRange = require_valid2(), outside = require_outside(), gtr = require_gtr(), ltr = require_ltr(), intersects = require_intersects(), simplifyRange = require_simplify(), subset = require_subset();
823
823
  module.exports = {
824
824
  parse,
825
825
  valid,
@@ -843,7 +843,7 @@ var require_semver2 = __commonJS({
843
843
  gte,
844
844
  lte,
845
845
  cmp,
846
- coerce,
846
+ coerce: coerce2,
847
847
  Comparator,
848
848
  Range,
849
849
  satisfies: satisfies2,
@@ -1049,9 +1049,9 @@ async function postInstall(options) {
1049
1049
  }), findFile = (basename, extensions = EXTENSIONS) => any(
1050
1050
  extensions.map((ext) => basename + ext),
1051
1051
  { last: getProjectRoot(), cwd: options.configDir }
1052
- ), vitestVersionSpecifier = await packageManager.getInstalledVersion("vitest");
1053
- logger.debug(`Vitest version specifier: ${vitestVersionSpecifier}`);
1054
- let isVitest3_2To4 = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=3.2.0 <4.0.0") : !1, isVitest4OrNewer = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=4.0.0") : !0, info = await getStorybookInfo(options.configDir), allDeps = packageManager.getAllDependencies(), addonVitestService = new AddonVitestService(packageManager), compatibilityResult = await addonVitestService.validateCompatibility({
1052
+ ), allDeps = packageManager.getAllDependencies(), vitestVersionSpecifier = await packageManager.getInstalledVersion("vitest");
1053
+ !vitestVersionSpecifier && allDeps.vitest && (vitestVersionSpecifier = allDeps.vitest), vitestVersionSpecifier = (0, import_semver.coerce)(vitestVersionSpecifier)?.version ?? null, logger.debug(`Vitest version specifier: ${vitestVersionSpecifier}`);
1054
+ let isVitest3_2To4 = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=3.2.0 <4.0.0") : !1, isVitest4OrNewer = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=4.0.0") : !0, info = await getStorybookInfo(options.configDir), addonVitestService = new AddonVitestService(packageManager), compatibilityResult = await addonVitestService.validateCompatibility({
1055
1055
  framework: info.framework,
1056
1056
  builder: info.builder
1057
1057
  }), result = null;
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,10 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
12
12
  import {
13
13
  log,
14
14
  noop
15
- } from "./_node-chunks/chunk-7QM37EII.js";
15
+ } from "./_node-chunks/chunk-FPUVXKEJ.js";
16
16
  import {
17
17
  importMetaResolve
18
- } from "./_node-chunks/chunk-U43ZWEJJ.js";
18
+ } from "./_node-chunks/chunk-WPAXFGLJ.js";
19
19
  import {
20
20
  ADDON_ID,
21
21
  COVERAGE_DIRECTORY,
@@ -24,19 +24,19 @@ import {
24
24
  STORYBOOK_ADDON_TEST_CHANNEL,
25
25
  TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
26
26
  storeOptions
27
- } from "./_node-chunks/chunk-QZKT5ZP5.js";
27
+ } from "./_node-chunks/chunk-3K6GN7YH.js";
28
28
  import {
29
29
  require_picocolors
30
- } from "./_node-chunks/chunk-ITLWVDM3.js";
30
+ } from "./_node-chunks/chunk-NCM6J4H5.js";
31
31
  import {
32
32
  require_dist
33
- } from "./_node-chunks/chunk-QBJ4OELT.js";
33
+ } from "./_node-chunks/chunk-OXGGGOR4.js";
34
34
  import {
35
35
  normalize
36
- } from "./_node-chunks/chunk-V7JZVKO2.js";
36
+ } from "./_node-chunks/chunk-GOQHVJWY.js";
37
37
  import {
38
38
  __toESM
39
- } from "./_node-chunks/chunk-BHP6UQBM.js";
39
+ } from "./_node-chunks/chunk-YEIHTRUF.js";
40
40
 
41
41
  // src/preset.ts
42
42
  import { mkdir } from "node:fs/promises";
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __require,
15
15
  __toESM
16
- } from "../_node-chunks/chunk-BHP6UQBM.js";
16
+ } from "../_node-chunks/chunk-YEIHTRUF.js";
17
17
 
18
18
  // ../../../node_modules/tree-kill/index.js
19
19
  var require_tree_kill = __commonJS({
@@ -1,32 +1,33 @@
1
- import CJS_COMPAT_NODE_URL_2m85hsm10de from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2m85hsm10de from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2m85hsm10de from "node:module";
1
+ import CJS_COMPAT_NODE_URL_bnshjm7irir from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_bnshjm7irir from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_bnshjm7irir from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2m85hsm10de.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2m85hsm10de.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2m85hsm10de.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_bnshjm7irir.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_bnshjm7irir.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_bnshjm7irir.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  require_picocolors
14
- } from "../_node-chunks/chunk-ITLWVDM3.js";
14
+ } from "../_node-chunks/chunk-NCM6J4H5.js";
15
15
  import {
16
16
  require_dist
17
- } from "../_node-chunks/chunk-QBJ4OELT.js";
17
+ } from "../_node-chunks/chunk-OXGGGOR4.js";
18
18
  import {
19
19
  join,
20
20
  normalize,
21
+ path,
21
22
  relative,
22
23
  resolve,
23
24
  sep
24
- } from "../_node-chunks/chunk-V7JZVKO2.js";
25
+ } from "../_node-chunks/chunk-GOQHVJWY.js";
25
26
  import {
26
27
  __commonJS,
27
28
  __require,
28
29
  __toESM
29
- } from "../_node-chunks/chunk-BHP6UQBM.js";
30
+ } from "../_node-chunks/chunk-YEIHTRUF.js";
30
31
 
31
32
  // ../../../node_modules/braces/lib/utils.js
32
33
  var require_utils = __commonJS({
@@ -704,7 +705,7 @@ var require_braces = __commonJS({
704
705
  var require_constants2 = __commonJS({
705
706
  "../../../node_modules/picomatch/lib/constants.js"(exports, module) {
706
707
  "use strict";
707
- var path = __require("path"), WIN_SLASH = "\\\\/", WIN_NO_SLASH = `[^${WIN_SLASH}]`, DOT_LITERAL = "\\.", PLUS_LITERAL = "\\+", QMARK_LITERAL = "\\?", SLASH_LITERAL = "\\/", ONE_CHAR = "(?=.)", QMARK = "[^/]", END_ANCHOR = `(?:${SLASH_LITERAL}|$)`, START_ANCHOR = `(?:^|${SLASH_LITERAL})`, DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`, NO_DOT = `(?!${DOT_LITERAL})`, NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`, NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`, NO_DOTS_SLASH = `(?!${DOTS_SLASH})`, QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`, STAR = `${QMARK}*?`, POSIX_CHARS = {
708
+ var path2 = __require("path"), WIN_SLASH = "\\\\/", WIN_NO_SLASH = `[^${WIN_SLASH}]`, DOT_LITERAL = "\\.", PLUS_LITERAL = "\\+", QMARK_LITERAL = "\\?", SLASH_LITERAL = "\\/", ONE_CHAR = "(?=.)", QMARK = "[^/]", END_ANCHOR = `(?:${SLASH_LITERAL}|$)`, START_ANCHOR = `(?:^|${SLASH_LITERAL})`, DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`, NO_DOT = `(?!${DOT_LITERAL})`, NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`, NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`, NO_DOTS_SLASH = `(?!${DOTS_SLASH})`, QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`, STAR = `${QMARK}*?`, POSIX_CHARS = {
708
709
  DOT_LITERAL,
709
710
  PLUS_LITERAL,
710
711
  QMARK_LITERAL,
@@ -854,7 +855,7 @@ var require_constants2 = __commonJS({
854
855
  /* | */
855
856
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
856
857
  /* \uFEFF */
857
- SEP: path.sep,
858
+ SEP: path2.sep,
858
859
  /**
859
860
  * Create EXTGLOB_CHARS
860
861
  */
@@ -881,7 +882,7 @@ var require_constants2 = __commonJS({
881
882
  var require_utils2 = __commonJS({
882
883
  "../../../node_modules/picomatch/lib/utils.js"(exports) {
883
884
  "use strict";
884
- var path = __require("path"), win32 = process.platform === "win32", {
885
+ var path2 = __require("path"), win32 = process.platform === "win32", {
885
886
  REGEX_BACKSLASH,
886
887
  REGEX_REMOVE_BACKSLASH,
887
888
  REGEX_SPECIAL_CHARS,
@@ -897,7 +898,7 @@ var require_utils2 = __commonJS({
897
898
  let segs = process.version.slice(1).split(".").map(Number);
898
899
  return segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10;
899
900
  };
900
- exports.isWindows = (options) => options && typeof options.windows == "boolean" ? options.windows : win32 === !0 || path.sep === "\\";
901
+ exports.isWindows = (options) => options && typeof options.windows == "boolean" ? options.windows : win32 === !0 || path2.sep === "\\";
901
902
  exports.escapeLast = (input, char, lastIdx) => {
902
903
  let idx = input.lastIndexOf(char, lastIdx);
903
904
  return idx === -1 ? input : input[idx - 1] === "\\" ? exports.escapeLast(input, char, idx - 1) : `${input.slice(0, idx)}\\${input.slice(idx)}`;
@@ -1548,7 +1549,7 @@ var require_parse2 = __commonJS({
1548
1549
  var require_picomatch = __commonJS({
1549
1550
  "../../../node_modules/picomatch/lib/picomatch.js"(exports, module) {
1550
1551
  "use strict";
1551
- var path = __require("path"), scan = require_scan(), parse = require_parse2(), utils = require_utils2(), constants = require_constants2(), isObject = (val) => val && typeof val == "object" && !Array.isArray(val), picomatch = (glob, options, returnState = !1) => {
1552
+ var path2 = __require("path"), scan = require_scan(), parse = require_parse2(), utils = require_utils2(), constants = require_constants2(), isObject = (val) => val && typeof val == "object" && !Array.isArray(val), picomatch = (glob, options, returnState = !1) => {
1552
1553
  if (Array.isArray(glob)) {
1553
1554
  let fns = glob.map((input) => picomatch(input, options, returnState));
1554
1555
  return (str) => {
@@ -1583,7 +1584,7 @@ var require_picomatch = __commonJS({
1583
1584
  let opts = options || {}, format = opts.format || (posix ? utils.toPosixSlashes : null), match2 = input === glob, output = match2 && format ? format(input) : input;
1584
1585
  return match2 === !1 && (output = format ? format(input) : input, match2 = output === glob), (match2 === !1 || opts.capture === !0) && (opts.matchBase === !0 || opts.basename === !0 ? match2 = picomatch.matchBase(input, regex, options, posix) : match2 = regex.exec(output)), { isMatch: !!match2, match: match2, output };
1585
1586
  };
1586
- picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path.basename(input));
1587
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path2.basename(input));
1587
1588
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1588
1589
  picomatch.parse = (pattern, options) => Array.isArray(pattern) ? pattern.map((p) => picomatch.parse(p, options)) : parse(pattern, { ...options, fastpaths: !1 });
1589
1590
  picomatch.scan = (input, options) => scan(input, options);
@@ -2333,10 +2334,11 @@ import {
2333
2334
  } from "storybook/internal/common";
2334
2335
  import {
2335
2336
  StoryIndexGenerator,
2337
+ Tag,
2336
2338
  experimental_loadStorybook,
2337
2339
  mapStaticDir
2338
2340
  } from "storybook/internal/core-server";
2339
- import { readConfig, vitestTransform } from "storybook/internal/csf-tools";
2341
+ import { componentTransform, readConfig, vitestTransform } from "storybook/internal/csf-tools";
2340
2342
  import { MainFileMissingError } from "storybook/internal/server-errors";
2341
2343
  import { telemetry } from "storybook/internal/telemetry";
2342
2344
  import { oneWayHash } from "storybook/internal/telemetry";
@@ -2382,13 +2384,42 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2382
2384
  load(id) {
2383
2385
  return id.endsWith(".mdx") ? "export default {};" : null;
2384
2386
  }
2387
+ }, getComponentTestPaths = () => {
2388
+ let envPaths = process.env.STORYBOOK_COMPONENT_PATHS;
2389
+ return envPaths ? envPaths.split(";").filter(Boolean) : [];
2390
+ }, createComponentTestTransformPlugin = (presets, configDir) => {
2391
+ let storybookComponentTestPaths = getComponentTestPaths();
2392
+ return {
2393
+ name: "storybook:component-test-transform-plugin",
2394
+ transform: {
2395
+ order: "pre",
2396
+ async handler(code, id) {
2397
+ if (!optionalEnvToBoolean(process.env.VITEST) || storybookComponentTestPaths.length === 0)
2398
+ return code;
2399
+ let resolvedId = path.resolve(id);
2400
+ return storybookComponentTestPaths.some(
2401
+ (testPath) => resolvedId === testPath || resolvedId.startsWith(testPath + path.sep) || resolvedId.endsWith(testPath)
2402
+ ) ? (await componentTransform({
2403
+ code,
2404
+ fileName: id,
2405
+ getComponentArgTypes: async ({ componentName, fileName }) => presets.apply("internal_getArgTypesData", null, {
2406
+ componentFilePath: fileName,
2407
+ componentExportName: componentName,
2408
+ configDir
2409
+ })
2410
+ })).code : code;
2411
+ }
2412
+ }
2413
+ };
2385
2414
  }, storybookTest = async (options) => {
2415
+ if (!optionalEnvToBoolean(process.env.VITEST))
2416
+ return [];
2386
2417
  let finalOptions = {
2387
2418
  ...defaultOptions,
2388
2419
  ...options,
2389
2420
  configDir: options?.configDir ? resolve(WORKING_DIR, options.configDir) : defaultOptions.configDir,
2390
2421
  tags: {
2391
- include: options?.tags?.include ?? ["test"],
2422
+ include: options?.tags?.include ?? [Tag.TEST],
2392
2423
  exclude: options?.tags?.exclude ?? [],
2393
2424
  skip: options?.tags?.skip ?? []
2394
2425
  }
@@ -2403,7 +2434,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2403
2434
  }), stories = await presets.apply("stories", []), commonConfig = { root: resolve(finalOptions.configDir, "..") }, [
2404
2435
  { storiesGlobs },
2405
2436
  framework,
2406
- storybookEnv,
2407
2437
  viteConfigFromStorybook,
2408
2438
  staticDirs,
2409
2439
  previewLevelTags,
@@ -2413,7 +2443,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2413
2443
  ] = await Promise.all([
2414
2444
  getStoryGlobsAndFiles(presets, directories),
2415
2445
  presets.apply("framework", void 0),
2416
- presets.apply("env", {}),
2417
2446
  presets.apply("viteFinal", commonConfig),
2418
2447
  presets.apply("staticDirs", []),
2419
2448
  extractTagsFromPreview(finalOptions.configDir),
@@ -2439,7 +2468,8 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2439
2468
  ]);
2440
2469
  return html.replace("</head>", `${headHtmlSnippet ?? ""}</head>`).replace("<body>", `<body>${bodyHtmlSnippet ?? ""}`);
2441
2470
  },
2442
- async config(nonMutableInputConfig) {
2471
+ async config(nonMutableInputConfig, { mode }) {
2472
+ mode && (process.env.BUILD_TARGET = mode);
2443
2473
  try {
2444
2474
  await validateConfigurationFiles(finalOptions.configDir);
2445
2475
  } catch {
@@ -2471,7 +2501,15 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2471
2501
  ]
2472
2502
  } : {},
2473
2503
  env: {
2474
- ...storybookEnv,
2504
+ /**
2505
+ * We do this late, because we need vitest's --mode to be available and set to
2506
+ * BUILD_MODE. Unfortunately, the dependencies we use to load .env files can only be
2507
+ * configured using that environment variable. We need it to be synced up with the mode
2508
+ * that vitest is running in, or risk leaking envs from the wrong file.
2509
+ *
2510
+ * @see https://github.com/storybookjs/storybook/issues/33101
2511
+ */
2512
+ ...await presets.apply("env", {}),
2475
2513
  // To be accessed by the setup file
2476
2514
  __STORYBOOK_URL__: finalOptions.storybookUrl,
2477
2515
  VITEST_STORYBOOK: isVitestStorybook ? "true" : "false",
@@ -2479,7 +2517,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2479
2517
  __VITEST_EXCLUDE_TAGS__: finalOptions.tags.exclude.join(","),
2480
2518
  __VITEST_SKIP_TAGS__: finalOptions.tags.skip.join(",")
2481
2519
  },
2482
- include: includeStories,
2520
+ include: [...includeStories, ...getComponentTestPaths()],
2483
2521
  exclude: [
2484
2522
  ...nonMutableInputConfig.test?.exclude ?? [],
2485
2523
  join(relative(finalOptions.vitestRoot, process.cwd()), "**/*.mdx").replaceAll(sep, "/")
@@ -2496,12 +2534,12 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2496
2534
  browser: {
2497
2535
  commands: {
2498
2536
  getInitialGlobals: () => {
2499
- let envConfig = JSON.parse(process.env.VITEST_STORYBOOK_CONFIG ?? "{}");
2500
- return {
2501
- a11y: {
2502
- manual: !(isVitestStorybook ? envConfig.a11y ?? !1 : !0)
2503
- }
2504
- };
2537
+ let envConfig = JSON.parse(process.env.VITEST_STORYBOOK_CONFIG ?? "{}"), shouldRunA11yTests = isVitestStorybook ? envConfig.a11y ?? !1 : !0, globals = {};
2538
+ return globals.a11y = {
2539
+ manual: !shouldRunA11yTests
2540
+ }, process.env.STORYBOOK_COMPONENT_PATHS && (globals.ghostStories = {
2541
+ enabled: !0
2542
+ }), globals;
2505
2543
  }
2506
2544
  },
2507
2545
  // if there is a test.browser config AND test.browser.screenshotFailures is not explicitly set, we set it to false
@@ -2581,8 +2619,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2581
2619
  }
2582
2620
  },
2583
2621
  async transform(code, id) {
2584
- if (!optionalEnvToBoolean(process.env.VITEST))
2585
- return code;
2586
2622
  let relativeId = relative(finalOptions.vitestRoot, id);
2587
2623
  if ((0, import_micromatch.match)([relativeId], finalOptions.includeStories).length > 0)
2588
2624
  return vitestTransform({
@@ -2595,7 +2631,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2595
2631
  });
2596
2632
  }
2597
2633
  };
2598
- if (plugins.push(storybookTestPlugin), isVitestStorybook) {
2634
+ if (getComponentTestPaths().length > 0 && plugins.push(createComponentTestTransformPlugin(presets, finalOptions.configDir)), plugins.push(storybookTestPlugin), isVitestStorybook) {
2599
2635
  let projectName = `storybook:${normalize(finalOptions.configDir)}`;
2600
2636
  plugins.push({
2601
2637
  name: "storybook:workspace-name-override",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PANEL_ID
3
- } from "../_browser-chunks/chunk-TJXI7EIW.js";
3
+ } from "../_browser-chunks/chunk-QHH5JRC6.js";
4
4
 
5
5
  // src/vitest-plugin/setup-file.ts
6
6
  import { afterEach, beforeAll, vi } from "vitest";
@@ -50,7 +50,16 @@ var DEFAULT_VIEWPORT_DIMENSIONS = {
50
50
  };
51
51
 
52
52
  // src/vitest-plugin/test-utils.ts
53
- var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.replace(/^file:\/\//, "").replace(/^\/+([a-zA-Z]:)/, "$1").replace(/%20/g, " "), testStory = (exportName, story, meta, skipTags, storyId, testName) => async (context) => {
53
+ var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.replace(/^file:\/\//, "").replace(/^\/+([a-zA-Z]:)/, "$1").replace(/%20/g, " "), testStory = ({
54
+ exportName,
55
+ story,
56
+ meta,
57
+ skipTags,
58
+ storyId,
59
+ componentPath,
60
+ testName,
61
+ componentName
62
+ }) => async (context) => {
54
63
  let annotations = getCsfFactoryAnnotations(story, meta), test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0, storyAnnotations = test ? test.input : annotations.story, composedStory = composeStory(
55
64
  storyAnnotations,
56
65
  annotations.meta,
@@ -60,7 +69,7 @@ var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.re
60
69
  );
61
70
  (composedStory === void 0 || skipTags?.some((tag) => composedStory.tags.includes(tag))) && context.skip(), context.story = composedStory;
62
71
  let _task = context.task;
63
- _task.meta.storyId = storyId, await setViewport(composedStory.parameters, composedStory.globals), await composedStory.run(void 0), _task.meta.reports = composedStory.reporting.reports;
72
+ _task.meta.storyId = storyId, _task.meta.componentPath = componentPath, _task.meta.componentName = componentName, await setViewport(composedStory.parameters, composedStory.globals), await composedStory.run(void 0), _task.meta.reports = composedStory.reporting.reports;
64
73
  };
65
74
  export {
66
75
  convertToFilePath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "10.2.0-alpha.9",
3
+ "version": "10.2.0-beta.1",
4
4
  "description": "Storybook Vitest addon: Blazing fast component testing using stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -69,37 +69,37 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "@storybook/global": "^5.0.0",
72
- "@storybook/icons": "^2.0.0"
72
+ "@storybook/icons": "^2.0.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/istanbul-lib-report": "^3.0.3",
76
76
  "@types/micromatch": "^4.0.0",
77
- "@types/node": "^22.0.0",
78
- "@types/semver": "^7",
77
+ "@types/node": "^22.19.1",
78
+ "@types/semver": "^7.7.1",
79
79
  "@vitest/browser-playwright": "^4.0.14",
80
80
  "@vitest/runner": "^4.0.14",
81
81
  "empathic": "^2.0.0",
82
- "es-toolkit": "^1.36.0",
82
+ "es-toolkit": "^1.43.0",
83
83
  "istanbul-lib-report": "^3.0.1",
84
84
  "micromatch": "^4.0.8",
85
85
  "pathe": "^1.1.2",
86
86
  "picocolors": "^1.1.0",
87
87
  "react": "^18.2.0",
88
88
  "react-dom": "^18.2.0",
89
- "semver": "^7.6.3",
89
+ "semver": "^7.7.3",
90
90
  "sirv": "^2.0.4",
91
91
  "slash": "^5.0.0",
92
92
  "tinyglobby": "^0.2.10",
93
93
  "tree-kill": "^1.2.2",
94
94
  "ts-dedent": "^2.2.0",
95
- "typescript": "^5.8.3",
95
+ "typescript": "^5.9.3",
96
96
  "vitest": "^4.0.14"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@vitest/browser": "^3.0.0 || ^4.0.0",
100
100
  "@vitest/browser-playwright": "^4.0.0",
101
101
  "@vitest/runner": "^3.0.0 || ^4.0.0",
102
- "storybook": "^10.2.0-alpha.9",
102
+ "storybook": "^10.2.0-beta.1",
103
103
  "vitest": "^3.0.0 || ^4.0.0"
104
104
  },
105
105
  "peerDependenciesMeta": {