@storybook/addon-vitest 0.0.0-pr-33092-sha-c8460b7a → 0.0.0-pr-33102-sha-748eeb18
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.
- package/dist/_node-chunks/{chunk-BYNAAADB.js → chunk-3S37LHFK.js} +7 -7
- package/dist/_node-chunks/chunk-4GEBPZYM.js +158 -0
- package/dist/_node-chunks/chunk-6LHGT4I6.js +38 -0
- package/dist/_node-chunks/chunk-GECNS5B7.js +44 -0
- package/dist/_node-chunks/{chunk-H6AFC5BW.js → chunk-H5WR75RY.js} +7 -19
- package/dist/_node-chunks/{chunk-SXPPGPJV.js → chunk-K6BLOPHU.js} +7 -7
- package/dist/_node-chunks/{chunk-UVEHSNL5.js → chunk-PXAL7NKQ.js} +6 -6
- package/dist/_node-chunks/chunk-SRNV5GEP.js +61 -0
- package/dist/_node-chunks/{chunk-A4JN7TXM.js → chunk-XSEBM2WQ.js} +6 -6
- package/dist/manager.js +1 -1
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +24 -14
- package/dist/postinstall.js +152 -290
- package/dist/preset.js +30 -25
- package/dist/vitest-plugin/global-setup.js +8 -9
- package/dist/vitest-plugin/index.js +33 -34
- package/dist/vitest-plugin/setup-file.js +1 -1
- package/package.json +3 -7
- package/dist/_node-chunks/chunk-NRFGFKG2.js +0 -1697
- package/dist/_node-chunks/chunk-PO7D7KB7.js +0 -69
- package/dist/_node-chunks/chunk-QPB2GCIO.js +0 -35
- /package/dist/_browser-chunks/{chunk-ULSHVN74.js → chunk-TYJENCK5.js} +0 -0
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0vuwk8hbn3 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0vuwk8hbn3 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0vuwk8hbn3 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0vuwk8hbn3.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0vuwk8hbn3.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0vuwk8hbn3.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,11 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_vshh9fntxdn.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-6LHGT4I6.js";
|
|
16
16
|
import {
|
|
17
|
-
execaNode,
|
|
18
17
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
18
|
+
} from "./_node-chunks/chunk-4GEBPZYM.js";
|
|
20
19
|
import {
|
|
21
20
|
ADDON_ID,
|
|
22
21
|
COVERAGE_DIRECTORY,
|
|
@@ -25,16 +24,19 @@ import {
|
|
|
25
24
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
26
25
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
27
26
|
storeOptions
|
|
28
|
-
} from "./_node-chunks/chunk-
|
|
27
|
+
} from "./_node-chunks/chunk-H5WR75RY.js";
|
|
29
28
|
import {
|
|
30
29
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-3S37LHFK.js";
|
|
31
|
+
import {
|
|
32
|
+
require_dist
|
|
33
|
+
} from "./_node-chunks/chunk-SRNV5GEP.js";
|
|
32
34
|
import {
|
|
33
35
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
36
|
+
} from "./_node-chunks/chunk-PXAL7NKQ.js";
|
|
35
37
|
import {
|
|
36
38
|
__toESM
|
|
37
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-XSEBM2WQ.js";
|
|
38
40
|
|
|
39
41
|
// src/preset.ts
|
|
40
42
|
import { mkdir } from "node:fs/promises";
|
|
@@ -205,11 +207,11 @@ function isEqual(a, b) {
|
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
// src/preset.ts
|
|
208
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
209
|
-
import { dedent } from "ts-dedent";
|
|
210
|
+
var import_picocolors = __toESM(require_picocolors(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
210
211
|
|
|
211
212
|
// src/node/boot-test-runner.ts
|
|
212
213
|
import { fileURLToPath } from "node:url";
|
|
214
|
+
import { executeNodeCommand } from "storybook/internal/common";
|
|
213
215
|
import {
|
|
214
216
|
internal_universalStatusStore,
|
|
215
217
|
internal_universalTestProviderStore
|
|
@@ -234,15 +236,18 @@ var MAX_START_TIME = 3e4, vitestModulePath = fileURLToPath(importMetaResolve("@s
|
|
|
234
236
|
};
|
|
235
237
|
process.on("exit", exit), process.on("SIGINT", () => exit(0)), process.on("SIGTERM", () => exit(0));
|
|
236
238
|
let startChildProcess = () => new Promise((resolve, reject) => {
|
|
237
|
-
child =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
child = executeNodeCommand({
|
|
240
|
+
scriptPath: vitestModulePath,
|
|
241
|
+
options: {
|
|
242
|
+
env: {
|
|
243
|
+
VITEST: "true",
|
|
244
|
+
TEST: "true",
|
|
245
|
+
VITEST_CHILD_PROCESS: "true",
|
|
246
|
+
NODE_ENV: process.env.NODE_ENV ?? "test",
|
|
247
|
+
STORYBOOK_CONFIG_DIR: normalize(options.configDir)
|
|
248
|
+
},
|
|
249
|
+
extendEnv: !0
|
|
250
|
+
}
|
|
246
251
|
}), stderr = [], child.stdout?.on("data", log), child.stderr?.on("data", (data) => {
|
|
247
252
|
data.toString().match(/^\u001B\[33m/) || (log(data), stderr.push(data.toString()));
|
|
248
253
|
}), unsubscribeStore = store.subscribe(forwardUniversalStoreEvent(STORE_CHANNEL_EVENT_NAME)), unsubscribeStatusStore = internal_universalStatusStore.subscribe(
|
|
@@ -303,7 +308,7 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
303
308
|
options
|
|
304
309
|
), resolvedPreviewBuilder = typeof core?.builder == "string" ? core.builder : core?.builder?.name, framework = await getFrameworkName(options);
|
|
305
310
|
if (!resolvedPreviewBuilder?.includes("vite"))
|
|
306
|
-
return framework.includes("nextjs") && log(dedent`
|
|
311
|
+
return framework.includes("nextjs") && log(import_ts_dedent.dedent`
|
|
307
312
|
You're using ${framework}, which is a Webpack-based builder. In order to use Storybook Test, with your project, you need to use '@storybook/nextjs-vite', a high performance Vite-based equivalent.
|
|
308
313
|
|
|
309
314
|
Information on how to upgrade here: ${import_picocolors.default.yellow("https://storybook.js.org/docs/get-started/frameworks/nextjs?ref=upgrade#with-vite")}\n
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0vuwk8hbn3 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0vuwk8hbn3 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0vuwk8hbn3 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0vuwk8hbn3.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0vuwk8hbn3.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0vuwk8hbn3.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-
|
|
16
|
+
} from "../_node-chunks/chunk-XSEBM2WQ.js";
|
|
17
17
|
|
|
18
18
|
// ../../node_modules/tree-kill/index.js
|
|
19
19
|
var require_tree_kill = __commonJS({
|
|
@@ -121,8 +121,7 @@ var storybookProcess = null, getIsVitestStandaloneRun = () => {
|
|
|
121
121
|
try {
|
|
122
122
|
storybookProcess = spawn(storybookScript, [], {
|
|
123
123
|
stdio: process.env.DEBUG === "storybook" ? "pipe" : "ignore",
|
|
124
|
-
cwd: process.cwd()
|
|
125
|
-
shell: !0
|
|
124
|
+
cwd: process.cwd()
|
|
126
125
|
}), storybookProcess.on("error", (error) => {
|
|
127
126
|
throw logger.verbose("Failed to start Storybook:" + error.message), error;
|
|
128
127
|
});
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_0vuwk8hbn3 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_0vuwk8hbn3 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_0vuwk8hbn3 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_0vuwk8hbn3.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_0vuwk8hbn3.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_0vuwk8hbn3.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-
|
|
14
|
+
} from "../_node-chunks/chunk-3S37LHFK.js";
|
|
15
15
|
import {
|
|
16
|
+
require_dist
|
|
17
|
+
} from "../_node-chunks/chunk-SRNV5GEP.js";
|
|
18
|
+
import {
|
|
19
|
+
dirname,
|
|
16
20
|
join,
|
|
17
21
|
normalize,
|
|
18
22
|
relative,
|
|
19
23
|
resolve,
|
|
20
24
|
sep
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-PXAL7NKQ.js";
|
|
22
26
|
import {
|
|
23
27
|
__commonJS,
|
|
24
28
|
__require,
|
|
25
29
|
__toESM
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
30
|
+
} from "../_node-chunks/chunk-XSEBM2WQ.js";
|
|
27
31
|
|
|
28
32
|
// ../../node_modules/braces/lib/utils.js
|
|
29
33
|
var require_utils = __commonJS({
|
|
@@ -2323,7 +2327,6 @@ import { mergeConfig } from "vitest/config";
|
|
|
2323
2327
|
import {
|
|
2324
2328
|
DEFAULT_FILES_PATTERN,
|
|
2325
2329
|
getInterpretedFile,
|
|
2326
|
-
loadPreviewOrConfigFile,
|
|
2327
2330
|
normalizeStories,
|
|
2328
2331
|
optionalEnvToBoolean,
|
|
2329
2332
|
resolvePathInStorybookCache,
|
|
@@ -2338,8 +2341,7 @@ import { readConfig, vitestTransform } from "storybook/internal/csf-tools";
|
|
|
2338
2341
|
import { MainFileMissingError } from "storybook/internal/server-errors";
|
|
2339
2342
|
import { telemetry } from "storybook/internal/telemetry";
|
|
2340
2343
|
import { oneWayHash } from "storybook/internal/telemetry";
|
|
2341
|
-
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1);
|
|
2342
|
-
import { dedent } from "ts-dedent";
|
|
2344
|
+
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
2343
2345
|
|
|
2344
2346
|
// ../../builders/builder-vite/src/utils/without-vite-plugins.ts
|
|
2345
2347
|
var withoutVitePlugins = async (plugins = [], namesToRemove) => {
|
|
@@ -2372,13 +2374,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2372
2374
|
new Map(matchingStoryFiles.map(([specifier, cache]) => [specifier, cache]))
|
|
2373
2375
|
)
|
|
2374
2376
|
};
|
|
2375
|
-
}, processPreviewAnnotation = (path, projectRoot) => typeof path == "object" ? path.bare != null && path.absolute === "" ? path.bare : normalize(path.absolute) : path.startsWith("/") || path.match(/^[a-zA-Z]:/) ? normalize(path) : normalize(resolve(projectRoot, path)), getPreviewAnnotations = async (presets, configDir, projectRoot) => {
|
|
2376
|
-
let previewAnnotations = await presets.apply("previewAnnotations", [], {}), previewOrConfigFile = loadPreviewOrConfigFile({ configDir });
|
|
2377
|
-
return [...previewAnnotations, previewOrConfigFile].filter(
|
|
2378
|
-
(entry) => entry !== void 0
|
|
2379
|
-
).map(
|
|
2380
|
-
(annotation) => processPreviewAnnotation(annotation, projectRoot)
|
|
2381
|
-
);
|
|
2382
2377
|
}, mdxStubPlugin = {
|
|
2383
2378
|
name: "storybook:stub-mdx-plugin",
|
|
2384
2379
|
enforce: "pre",
|
|
@@ -2407,7 +2402,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2407
2402
|
configDir: finalOptions.configDir,
|
|
2408
2403
|
packageJson: {}
|
|
2409
2404
|
}), stories = await presets.apply("stories", []), [
|
|
2410
|
-
{ storiesGlobs
|
|
2405
|
+
{ storiesGlobs },
|
|
2411
2406
|
framework,
|
|
2412
2407
|
storybookEnv,
|
|
2413
2408
|
viteConfigFromStorybook,
|
|
@@ -2415,8 +2410,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2415
2410
|
previewLevelTags,
|
|
2416
2411
|
core,
|
|
2417
2412
|
extraOptimizeDeps,
|
|
2418
|
-
features
|
|
2419
|
-
previewAnnotations
|
|
2413
|
+
features
|
|
2420
2414
|
] = await Promise.all([
|
|
2421
2415
|
getStoryGlobsAndFiles(presets, directories),
|
|
2422
2416
|
presets.apply("framework", void 0),
|
|
@@ -2426,8 +2420,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2426
2420
|
extractTagsFromPreview(finalOptions.configDir),
|
|
2427
2421
|
presets.apply("core"),
|
|
2428
2422
|
presets.apply("optimizeViteDeps", []),
|
|
2429
|
-
presets.apply("features", {})
|
|
2430
|
-
getPreviewAnnotations(presets, finalOptions.configDir, WORKING_DIR)
|
|
2423
|
+
presets.apply("features", {})
|
|
2431
2424
|
]), pluginsToIgnore = [
|
|
2432
2425
|
"storybook:react-docgen-plugin",
|
|
2433
2426
|
"vite:react-docgen-typescript",
|
|
@@ -2463,7 +2456,13 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2463
2456
|
return typeof story == "string" ? storyPath = story : storyPath = `${story.directory}/${story.files ?? DEFAULT_FILES_PATTERN}`, join(finalOptions.configDir, storyPath);
|
|
2464
2457
|
}).map((story) => relative(finalOptions.vitestRoot, story));
|
|
2465
2458
|
finalOptions.includeStories = includeStories;
|
|
2466
|
-
let projectId = oneWayHash(finalOptions.configDir),
|
|
2459
|
+
let projectId = oneWayHash(finalOptions.configDir), resolvedSetupFile = (() => {
|
|
2460
|
+
try {
|
|
2461
|
+
return fileURLToPath(import.meta.resolve("@storybook/addon-vitest/internal/setup-file"));
|
|
2462
|
+
} catch {
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
})(), baseConfig = {
|
|
2467
2466
|
cacheDir: resolvePathInStorybookCache("sb-vitest", projectId),
|
|
2468
2467
|
test: {
|
|
2469
2468
|
setupFiles: [
|
|
@@ -2534,13 +2533,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2534
2533
|
]
|
|
2535
2534
|
},
|
|
2536
2535
|
optimizeDeps: {
|
|
2537
|
-
// Include both story files and preview annotation files as entries.
|
|
2538
|
-
// Vite will automatically discover and optimize dependencies from these entry points.
|
|
2539
|
-
// This prevents hard reloads caused by runtime dependency discovery.
|
|
2540
|
-
entries: [
|
|
2541
|
-
...storiesFiles.map((file) => relative(finalOptions.vitestRoot, file)),
|
|
2542
|
-
...previewAnnotations.map((file) => relative(finalOptions.vitestRoot, file))
|
|
2543
|
-
],
|
|
2544
2536
|
include: [
|
|
2545
2537
|
...extraOptimizeDeps,
|
|
2546
2538
|
"@storybook/addon-vitest/internal/setup-file",
|
|
@@ -2552,13 +2544,20 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2552
2544
|
define: {
|
|
2553
2545
|
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {},
|
|
2554
2546
|
FEATURES: JSON.stringify(features)
|
|
2555
|
-
}
|
|
2547
|
+
},
|
|
2548
|
+
...resolvedSetupFile ? {
|
|
2549
|
+
server: {
|
|
2550
|
+
fs: {
|
|
2551
|
+
allow: [dirname(resolvedSetupFile)]
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
} : {}
|
|
2556
2555
|
}, config = mergeConfig(
|
|
2557
2556
|
baseConfig,
|
|
2558
2557
|
viteConfigFromStorybook
|
|
2559
2558
|
);
|
|
2560
2559
|
return (nonMutableInputConfig.test?.include?.length ?? 0) > 0 && (nonMutableInputConfig.test.include = [], console.log(
|
|
2561
|
-
import_picocolors.default.yellow(dedent`
|
|
2560
|
+
import_picocolors.default.yellow(import_ts_dedent.dedent`
|
|
2562
2561
|
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.
|
|
2563
2562
|
|
|
2564
2563
|
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": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-33102-sha-748eeb18",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -73,9 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@storybook/global": "^5.0.0",
|
|
76
|
-
"@storybook/icons": "^2.0.0"
|
|
77
|
-
"prompts": "^2.4.0",
|
|
78
|
-
"ts-dedent": "^2.2.0"
|
|
76
|
+
"@storybook/icons": "^2.0.0"
|
|
79
77
|
},
|
|
80
78
|
"devDependencies": {
|
|
81
79
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
@@ -84,10 +82,8 @@
|
|
|
84
82
|
"@types/semver": "^7",
|
|
85
83
|
"@vitest/browser-playwright": "^4.0.1",
|
|
86
84
|
"@vitest/runner": "^4.0.1",
|
|
87
|
-
"boxen": "^8.0.1",
|
|
88
85
|
"empathic": "^2.0.0",
|
|
89
86
|
"es-toolkit": "^1.36.0",
|
|
90
|
-
"execa": "^8.0.1",
|
|
91
87
|
"istanbul-lib-report": "^3.0.1",
|
|
92
88
|
"micromatch": "^4.0.8",
|
|
93
89
|
"pathe": "^1.1.2",
|
|
@@ -107,7 +103,7 @@
|
|
|
107
103
|
"@vitest/browser": "^3.0.0 || ^4.0.0",
|
|
108
104
|
"@vitest/browser-playwright": "^4.0.0",
|
|
109
105
|
"@vitest/runner": "^3.0.0 || ^4.0.0",
|
|
110
|
-
"storybook": "^0.0.0-pr-
|
|
106
|
+
"storybook": "^0.0.0-pr-33102-sha-748eeb18",
|
|
111
107
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
112
108
|
},
|
|
113
109
|
"peerDependenciesMeta": {
|