@storybook/addon-vitest 11.0.0-beta.4 → 11.0.0-rc.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire as
|
|
1
|
+
import { createRequire as CJS_COMPAT_CREATE_REQUIRE_s3399qpvfzj } from "node:module";var require = CJS_COMPAT_CREATE_REQUIRE_s3399qpvfzj(import.meta.url);
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/postinstall.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import * as fs from "node:fs/promises";
|
|
22
22
|
import { writeFile } from "node:fs/promises";
|
|
23
23
|
import os from "node:os";
|
|
24
|
-
import { AddonVitestService } from "storybook/internal/cli";
|
|
24
|
+
import { AddonVitestService, refreshAgentInstructions } from "storybook/internal/cli";
|
|
25
25
|
import {
|
|
26
26
|
JsPackageManagerFactory,
|
|
27
27
|
formatFileContent,
|
|
@@ -460,7 +460,7 @@ async function postInstall(options) {
|
|
|
460
460
|
}
|
|
461
461
|
let runCommand = rootConfig ? "npx vitest --project=storybook" : "npx vitest";
|
|
462
462
|
if (errors.length === 0)
|
|
463
|
-
logger.step(CLI_COLORS.success("@storybook/addon-vitest setup completed successfully")), logger.log(import_ts_dedent.dedent`
|
|
463
|
+
await refreshAgentInstructions({ testSupported: !0, sawEveryStorybook: !1 }), logger.step(CLI_COLORS.success("@storybook/addon-vitest setup completed successfully")), logger.log(import_ts_dedent.dedent`
|
|
464
464
|
@storybook/addon-vitest is now configured and you're ready to run your tests!
|
|
465
465
|
Here are a couple of tips to get you started:
|
|
466
466
|
|
package/dist/preset.js
CHANGED
|
@@ -1147,7 +1147,6 @@ import {
|
|
|
1147
1147
|
} from "storybook/internal/core-server";
|
|
1148
1148
|
import {
|
|
1149
1149
|
defineToolset,
|
|
1150
|
-
getSkillCommand,
|
|
1151
1150
|
getToolset
|
|
1152
1151
|
} from "storybook/open-service";
|
|
1153
1152
|
|
|
@@ -1707,14 +1706,9 @@ var errorLikeSchema = object({
|
|
|
1707
1706
|
!0
|
|
1708
1707
|
)
|
|
1709
1708
|
});
|
|
1710
|
-
function describeRun(a11yEnabled
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
First run ${skill} once and follow it: it has the rules for running the tests and fixing what fails.` : ""}
|
|
1714
|
-
Run them after editing anything that changes how the UI looks \u2014 components, stories, styles, CSS, themes, colors, or design tokens \u2014 shell-level substitutes like typecheck, lint, or package.json test scripts do not replace this.
|
|
1715
|
-
Use changed for focused runs on what you changed (faster while iterating), or files for specific story files,
|
|
1716
|
-
and leave all of them out to run every story.
|
|
1717
|
-
Use this continuously to monitor test results as you work on your UI components and stories.
|
|
1709
|
+
function describeRun(a11yEnabled) {
|
|
1710
|
+
return `Run story tests.
|
|
1711
|
+
Use changed for the stories your changes affect, or files for specific story files, and leave both out to run every story.
|
|
1718
1712
|
Results will include passing/failing status` + (a11yEnabled ? `, and accessibility violation reports.
|
|
1719
1713
|
For visual/design accessibility violations (for example color contrast), ask the user before changing styles.` : ".");
|
|
1720
1714
|
}
|
|
@@ -1785,7 +1779,7 @@ function createTestToolset({
|
|
|
1785
1779
|
input: runInputSchema,
|
|
1786
1780
|
positional: "files",
|
|
1787
1781
|
title: "Run Storybook tests",
|
|
1788
|
-
description: (
|
|
1782
|
+
description: () => describeRun(a11yEnabled),
|
|
1789
1783
|
handler: async (input, ctx) => {
|
|
1790
1784
|
let done = await queue.wait();
|
|
1791
1785
|
try {
|
|
@@ -2332,7 +2332,8 @@ import {
|
|
|
2332
2332
|
normalizeStories,
|
|
2333
2333
|
optionalEnvToBoolean,
|
|
2334
2334
|
resolvePathInStorybookCache as resolvePathInStorybookCache2,
|
|
2335
|
-
validateConfigurationFiles
|
|
2335
|
+
validateConfigurationFiles,
|
|
2336
|
+
versions
|
|
2336
2337
|
} from "storybook/internal/common";
|
|
2337
2338
|
import {
|
|
2338
2339
|
StoryIndexGenerator,
|
|
@@ -2350,7 +2351,10 @@ import {
|
|
|
2350
2351
|
telemetry as telemetry2,
|
|
2351
2352
|
setTelemetryEnabled
|
|
2352
2353
|
} from "storybook/internal/telemetry";
|
|
2353
|
-
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 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-rc.0";
|
|
2354
2358
|
|
|
2355
2359
|
// ../../builders/builder-vite/src/utils/without-vite-plugins.ts
|
|
2356
2360
|
var withoutVitePlugins = async (plugins = [], namesToRemove) => {
|
|
@@ -2452,6 +2456,19 @@ function isStorybookInternalFrame(file) {
|
|
|
2452
2456
|
return !!file && INTERNAL_FRAME_PATTERNS.some((pattern) => pattern.test(file));
|
|
2453
2457
|
}
|
|
2454
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
|
+
|
|
2455
2472
|
// src/vitest-plugin/index.ts
|
|
2456
2473
|
var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
2457
2474
|
storybookScript: void 0,
|
|
@@ -2526,6 +2543,9 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2526
2543
|
}, storybookTest = async (options) => {
|
|
2527
2544
|
if (!optionalEnvToBoolean(process.env.VITEST))
|
|
2528
2545
|
return [];
|
|
2546
|
+
let incompatible = getIncompatibleStorybookMessage(version, versions.storybook);
|
|
2547
|
+
if (incompatible)
|
|
2548
|
+
throw new HandledError(incompatible);
|
|
2529
2549
|
let finalOptions = {
|
|
2530
2550
|
...defaultOptions,
|
|
2531
2551
|
...options,
|
|
@@ -2690,7 +2710,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2690
2710
|
}
|
|
2691
2711
|
}, config = mergeConfig(baseConfig, viteConfigFromStorybook);
|
|
2692
2712
|
return (nonMutableInputConfig.test?.include?.length ?? 0) > 0 && (nonMutableInputConfig.test.include = [], console.log(
|
|
2693
|
-
import_picocolors.default.yellow(
|
|
2713
|
+
import_picocolors.default.yellow(import_ts_dedent2.dedent`
|
|
2694
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.
|
|
2695
2715
|
|
|
2696
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-
|
|
3
|
+
"version": "11.0.0-rc.0",
|
|
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-
|
|
85
|
-
"@storybook/builder-vite": "11.0.0-
|
|
84
|
+
"@storybook/addon-a11y": "11.0.0-rc.0",
|
|
85
|
+
"@storybook/builder-vite": "11.0.0-rc.0",
|
|
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-
|
|
113
|
+
"storybook": "^11.0.0-rc.0",
|
|
114
114
|
"vitest": "^4.0.0 || ^5.0.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependenciesMeta": {
|