@storybook/addon-vitest 11.0.0-beta.3 → 11.0.0-beta.5

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,19 +1,8 @@
1
- import CJS_COMPAT_NODE_URL_dvfyhpwr65v from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_dvfyhpwr65v from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_dvfyhpwr65v from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_dvfyhpwr65v.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_dvfyhpwr65v.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_dvfyhpwr65v.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
1
  import {
13
2
  __commonJS,
14
3
  __require,
15
4
  __toESM
16
- } from "../_node-chunks/chunk-VM3B6QLG.js";
5
+ } from "../_node-chunks/chunk-PQZIOGBY.js";
17
6
 
18
7
  // ../../../node_modules/tree-kill/index.js
19
8
  var require_tree_kill = __commonJS({
@@ -1,20 +1,9 @@
1
- import CJS_COMPAT_NODE_URL_dvfyhpwr65v from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_dvfyhpwr65v from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_dvfyhpwr65v from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_dvfyhpwr65v.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_dvfyhpwr65v.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_dvfyhpwr65v.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
1
  import {
13
2
  require_picocolors
14
- } from "../_node-chunks/chunk-O6RHQ7RZ.js";
3
+ } from "../_node-chunks/chunk-MTTYIP6M.js";
15
4
  import {
16
5
  require_dist
17
- } from "../_node-chunks/chunk-YXGVPF7B.js";
6
+ } from "../_node-chunks/chunk-QKPKKS4R.js";
18
7
  import {
19
8
  join,
20
9
  normalize,
@@ -22,13 +11,13 @@ import {
22
11
  relative,
23
12
  resolve,
24
13
  sep
25
- } from "../_node-chunks/chunk-DFLNMLNU.js";
14
+ } from "../_node-chunks/chunk-VDP2ZJQR.js";
26
15
  import {
27
16
  STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
28
17
  STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
29
18
  STORYBOOK_TEST_FEATURES_PROVIDE_KEY,
30
19
  STORYBOOK_TEST_INITIAL_GLOBALS_PROVIDE_KEY
31
- } from "../_node-chunks/chunk-VLJFF3YI.js";
20
+ } from "../_node-chunks/chunk-G4HWSAOC.js";
32
21
  import {
33
22
  __commonJS,
34
23
  __esm,
@@ -36,7 +25,7 @@ import {
36
25
  __require,
37
26
  __toCommonJS,
38
27
  __toESM
39
- } from "../_node-chunks/chunk-VM3B6QLG.js";
28
+ } from "../_node-chunks/chunk-PQZIOGBY.js";
40
29
 
41
30
  // ../../../node_modules/braces/lib/utils.js
42
31
  var require_utils = __commonJS({
@@ -2343,7 +2332,8 @@ import {
2343
2332
  normalizeStories,
2344
2333
  optionalEnvToBoolean,
2345
2334
  resolvePathInStorybookCache as resolvePathInStorybookCache2,
2346
- validateConfigurationFiles
2335
+ validateConfigurationFiles,
2336
+ versions
2347
2337
  } from "storybook/internal/common";
2348
2338
  import {
2349
2339
  StoryIndexGenerator,
@@ -2361,7 +2351,10 @@ import {
2361
2351
  telemetry as telemetry2,
2362
2352
  setTelemetryEnabled
2363
2353
  } from "storybook/internal/telemetry";
2364
- var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 1), import_ts_dedent = __toESM(require_dist(), 1);
2354
+ var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 1), import_ts_dedent2 = __toESM(require_dist(), 1);
2355
+
2356
+ // package.json
2357
+ var version = "11.0.0-beta.5";
2365
2358
 
2366
2359
  // ../../builders/builder-vite/src/utils/without-vite-plugins.ts
2367
2360
  var withoutVitePlugins = async (plugins = [], namesToRemove) => {
@@ -2463,6 +2456,19 @@ function isStorybookInternalFrame(file) {
2463
2456
  return !!file && INTERNAL_FRAME_PATTERNS.some((pattern) => pattern.test(file));
2464
2457
  }
2465
2458
 
2459
+ // src/vitest-plugin/version-check.ts
2460
+ var import_ts_dedent = __toESM(require_dist(), 1);
2461
+ function getIncompatibleStorybookMessage(addonVersion, coreVersion) {
2462
+ let addonMajor = Number.parseInt(addonVersion, 10), coreMajor = Number.parseInt(coreVersion, 10);
2463
+ if (!(!addonMajor || !coreMajor || addonMajor === coreMajor))
2464
+ return import_ts_dedent.dedent`
2465
+ @storybook/addon-vitest@${addonVersion} is not compatible with storybook@${coreVersion}.
2466
+
2467
+ Several versions of Storybook are installed, for example when only some packages of a monorepo were upgraded.
2468
+ Run "npm ls storybook" to see which ones, then use the same version for every "storybook" and "@storybook/*" dependency.
2469
+ `;
2470
+ }
2471
+
2466
2472
  // src/vitest-plugin/index.ts
2467
2473
  var WORKING_DIR = process.cwd(), defaultOptions = {
2468
2474
  storybookScript: void 0,
@@ -2537,6 +2543,9 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2537
2543
  }, storybookTest = async (options) => {
2538
2544
  if (!optionalEnvToBoolean(process.env.VITEST))
2539
2545
  return [];
2546
+ let incompatible = getIncompatibleStorybookMessage(version, versions.storybook);
2547
+ if (incompatible)
2548
+ throw new HandledError(incompatible);
2540
2549
  let finalOptions = {
2541
2550
  ...defaultOptions,
2542
2551
  ...options,
@@ -2701,7 +2710,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2701
2710
  }
2702
2711
  }, config = mergeConfig(baseConfig, viteConfigFromStorybook);
2703
2712
  return (nonMutableInputConfig.test?.include?.length ?? 0) > 0 && (nonMutableInputConfig.test.include = [], console.log(
2704
- import_picocolors.default.yellow(import_ts_dedent.dedent`
2713
+ import_picocolors.default.yellow(import_ts_dedent2.dedent`
2705
2714
  Warning: Starting in Storybook 8.5.0-alpha.18, the "test.include" option in Vitest is discouraged in favor of just using the "stories" field in your Storybook configuration.
2706
2715
 
2707
2716
  The values you passed to "test.include" will be ignored, please remove them from your Vitest configuration where the Storybook plugin is applied.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "11.0.0-beta.3",
3
+ "version": "11.0.0-beta.5",
4
4
  "description": "Storybook Vitest addon: Blazing fast component testing using stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -81,8 +81,8 @@
81
81
  "@storybook/icons": "^2.0.2"
82
82
  },
83
83
  "devDependencies": {
84
- "@storybook/addon-a11y": "11.0.0-beta.3",
85
- "@storybook/builder-vite": "11.0.0-beta.3",
84
+ "@storybook/addon-a11y": "11.0.0-beta.5",
85
+ "@storybook/builder-vite": "11.0.0-beta.5",
86
86
  "@types/istanbul-lib-report": "^3.0.3",
87
87
  "@types/micromatch": "^4.0.0",
88
88
  "@types/node": "^22.19.1",
@@ -110,7 +110,7 @@
110
110
  "peerDependencies": {
111
111
  "@vitest/browser": "^4.0.0 || ^5.0.0",
112
112
  "@vitest/browser-playwright": "^4.0.0 || ^5.0.0",
113
- "storybook": "^11.0.0-beta.3",
113
+ "storybook": "^11.0.0-beta.5",
114
114
  "vitest": "^4.0.0 || ^5.0.0"
115
115
  },
116
116
  "peerDependenciesMeta": {
@@ -1,56 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_dvfyhpwr65v from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_dvfyhpwr65v from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_dvfyhpwr65v from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_dvfyhpwr65v.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_dvfyhpwr65v.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_dvfyhpwr65v.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- require_picocolors
14
- } from "./chunk-O6RHQ7RZ.js";
15
- import {
16
- ADDON_ID2 as ADDON_ID
17
- } from "./chunk-VLJFF3YI.js";
18
- import {
19
- __toESM
20
- } from "./chunk-VM3B6QLG.js";
21
-
22
- // src/logger.ts
23
- var import_picocolors = __toESM(require_picocolors(), 1);
24
- import { logger } from "storybook/internal/node-logger";
25
- var log = (message) => {
26
- logger.log(
27
- `${import_picocolors.default.magenta(ADDON_ID)}: ${message.toString().replaceAll(/(│\n|│ )/g, "").trim()}`
28
- );
29
- };
30
-
31
- // src/utils.ts
32
- function errorToErrorLike(error) {
33
- return {
34
- message: error.message,
35
- name: error.name,
36
- // avoid duplicating the error message in the stack trace
37
- stack: error.message + " " + error.stack?.replace(error.message, ""),
38
- cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
39
- };
40
- }
41
-
42
- // ../../../node_modules/es-toolkit/dist/function/noop.mjs
43
- function noop() {
44
- }
45
-
46
- // ../../../node_modules/es-toolkit/dist/_internal/globalThis.mjs
47
- var globalThis_ = typeof globalThis == "object" && globalThis || typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || /* @__PURE__ */ (function() {
48
- return this;
49
- })();
50
-
51
- export {
52
- log,
53
- errorToErrorLike,
54
- globalThis_,
55
- noop
56
- };