@storybook/addon-vitest 0.0.0-pr-33092-sha-c8460b7a → 0.0.0-pr-32795-sha-2ff8d295
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/_browser-chunks/{chunk-ULSHVN74.js → chunk-TJXI7EIW.js} +2 -1
- package/dist/_node-chunks/chunk-3GCLAEGA.js +61 -0
- package/dist/_node-chunks/{chunk-SXPPGPJV.js → chunk-4J4XM5TQ.js} +7 -7
- package/dist/_node-chunks/{chunk-UVEHSNL5.js → chunk-7AA22XYW.js} +6 -6
- package/dist/_node-chunks/chunk-ATXQIWRA.js +38 -0
- package/dist/_node-chunks/{chunk-PO7D7KB7.js → chunk-D4Z3PJPX.js} +6 -31
- package/dist/_node-chunks/{chunk-H6AFC5BW.js → chunk-GIB764DK.js} +8 -20
- package/dist/_node-chunks/{chunk-BYNAAADB.js → chunk-M6B3MXZI.js} +7 -7
- package/dist/_node-chunks/chunk-P2LBJM7Q.js +158 -0
- package/dist/_node-chunks/{chunk-A4JN7TXM.js → chunk-QWYWOSA6.js} +6 -6
- package/dist/manager.js +5 -2
- 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 +31 -26
- package/dist/vitest-plugin/global-setup.js +8 -9
- package/dist/vitest-plugin/index.js +17 -32
- 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-QPB2GCIO.js +0 -35
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nmuqhvjq15p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nmuqhvjq15p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nmuqhvjq15p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nmuqhvjq15p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nmuqhvjq15p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nmuqhvjq15p.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-ATXQIWRA.js";
|
|
16
16
|
import {
|
|
17
|
-
execaNode,
|
|
18
17
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
18
|
+
} from "./_node-chunks/chunk-P2LBJM7Q.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-GIB764DK.js";
|
|
29
28
|
import {
|
|
30
29
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-M6B3MXZI.js";
|
|
31
|
+
import {
|
|
32
|
+
require_dist
|
|
33
|
+
} from "./_node-chunks/chunk-3GCLAEGA.js";
|
|
32
34
|
import {
|
|
33
35
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
36
|
+
} from "./_node-chunks/chunk-7AA22XYW.js";
|
|
35
37
|
import {
|
|
36
38
|
__toESM
|
|
37
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-QWYWOSA6.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
|
|
@@ -380,7 +385,7 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
380
385
|
}), !core.disableTelemetry) {
|
|
381
386
|
let enableCrashReports = core.enableCrashReports || options.enableCrashReports;
|
|
382
387
|
channel.on(STORYBOOK_ADDON_TEST_CHANNEL, (event) => {
|
|
383
|
-
telemetry("addon-test", {
|
|
388
|
+
event.type !== "test-run-completed" && telemetry("addon-test", {
|
|
384
389
|
...event,
|
|
385
390
|
payload: {
|
|
386
391
|
...event.payload,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nmuqhvjq15p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nmuqhvjq15p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nmuqhvjq15p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nmuqhvjq15p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nmuqhvjq15p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nmuqhvjq15p.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-QWYWOSA6.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,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_nmuqhvjq15p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_nmuqhvjq15p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_nmuqhvjq15p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_nmuqhvjq15p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_nmuqhvjq15p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_nmuqhvjq15p.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-M6B3MXZI.js";
|
|
15
|
+
import {
|
|
16
|
+
require_dist
|
|
17
|
+
} from "../_node-chunks/chunk-3GCLAEGA.js";
|
|
15
18
|
import {
|
|
16
19
|
join,
|
|
17
20
|
normalize,
|
|
18
21
|
relative,
|
|
19
22
|
resolve,
|
|
20
23
|
sep
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-7AA22XYW.js";
|
|
22
25
|
import {
|
|
23
26
|
__commonJS,
|
|
24
27
|
__require,
|
|
25
28
|
__toESM
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
29
|
+
} from "../_node-chunks/chunk-QWYWOSA6.js";
|
|
27
30
|
|
|
28
31
|
// ../../node_modules/braces/lib/utils.js
|
|
29
32
|
var require_utils = __commonJS({
|
|
@@ -2323,7 +2326,6 @@ import { mergeConfig } from "vitest/config";
|
|
|
2323
2326
|
import {
|
|
2324
2327
|
DEFAULT_FILES_PATTERN,
|
|
2325
2328
|
getInterpretedFile,
|
|
2326
|
-
loadPreviewOrConfigFile,
|
|
2327
2329
|
normalizeStories,
|
|
2328
2330
|
optionalEnvToBoolean,
|
|
2329
2331
|
resolvePathInStorybookCache,
|
|
@@ -2338,8 +2340,7 @@ import { readConfig, vitestTransform } from "storybook/internal/csf-tools";
|
|
|
2338
2340
|
import { MainFileMissingError } from "storybook/internal/server-errors";
|
|
2339
2341
|
import { telemetry } from "storybook/internal/telemetry";
|
|
2340
2342
|
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";
|
|
2343
|
+
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
2343
2344
|
|
|
2344
2345
|
// ../../builders/builder-vite/src/utils/without-vite-plugins.ts
|
|
2345
2346
|
var withoutVitePlugins = async (plugins = [], namesToRemove) => {
|
|
@@ -2372,13 +2373,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2372
2373
|
new Map(matchingStoryFiles.map(([specifier, cache]) => [specifier, cache]))
|
|
2373
2374
|
)
|
|
2374
2375
|
};
|
|
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
2376
|
}, mdxStubPlugin = {
|
|
2383
2377
|
name: "storybook:stub-mdx-plugin",
|
|
2384
2378
|
enforce: "pre",
|
|
@@ -2407,7 +2401,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2407
2401
|
configDir: finalOptions.configDir,
|
|
2408
2402
|
packageJson: {}
|
|
2409
2403
|
}), stories = await presets.apply("stories", []), [
|
|
2410
|
-
{ storiesGlobs
|
|
2404
|
+
{ storiesGlobs },
|
|
2411
2405
|
framework,
|
|
2412
2406
|
storybookEnv,
|
|
2413
2407
|
viteConfigFromStorybook,
|
|
@@ -2415,8 +2409,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2415
2409
|
previewLevelTags,
|
|
2416
2410
|
core,
|
|
2417
2411
|
extraOptimizeDeps,
|
|
2418
|
-
features
|
|
2419
|
-
previewAnnotations
|
|
2412
|
+
features
|
|
2420
2413
|
] = await Promise.all([
|
|
2421
2414
|
getStoryGlobsAndFiles(presets, directories),
|
|
2422
2415
|
presets.apply("framework", void 0),
|
|
@@ -2426,8 +2419,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2426
2419
|
extractTagsFromPreview(finalOptions.configDir),
|
|
2427
2420
|
presets.apply("core"),
|
|
2428
2421
|
presets.apply("optimizeViteDeps", []),
|
|
2429
|
-
presets.apply("features", {})
|
|
2430
|
-
getPreviewAnnotations(presets, finalOptions.configDir, WORKING_DIR)
|
|
2422
|
+
presets.apply("features", {})
|
|
2431
2423
|
]), pluginsToIgnore = [
|
|
2432
2424
|
"storybook:react-docgen-plugin",
|
|
2433
2425
|
"vite:react-docgen-typescript",
|
|
@@ -2534,13 +2526,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2534
2526
|
]
|
|
2535
2527
|
},
|
|
2536
2528
|
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
2529
|
include: [
|
|
2545
2530
|
...extraOptimizeDeps,
|
|
2546
2531
|
"@storybook/addon-vitest/internal/setup-file",
|
|
@@ -2558,7 +2543,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2558
2543
|
viteConfigFromStorybook
|
|
2559
2544
|
);
|
|
2560
2545
|
return (nonMutableInputConfig.test?.include?.length ?? 0) > 0 && (nonMutableInputConfig.test.include = [], console.log(
|
|
2561
|
-
import_picocolors.default.yellow(dedent`
|
|
2546
|
+
import_picocolors.default.yellow(import_ts_dedent.dedent`
|
|
2562
2547
|
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
2548
|
|
|
2564
2549
|
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-32795-sha-2ff8d295",
|
|
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-32795-sha-2ff8d295",
|
|
111
107
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
112
108
|
},
|
|
113
109
|
"peerDependenciesMeta": {
|