@storybook/addon-vitest 0.0.0-pr-32572-sha-c9578275 → 0.0.0-pr-32412-sha-f670336d
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-55GJ6FPW.js → chunk-BH6F467E.js} +7 -7
- package/dist/_node-chunks/{chunk-W5CPPHT7.js → chunk-DVLGX7KC.js} +7 -7
- package/dist/_node-chunks/{chunk-USDVJHB5.js → chunk-GEFSDVGO.js} +6 -6
- package/dist/_node-chunks/{chunk-BVWYMI44.js → chunk-KS3JRSUN.js} +15 -325
- package/dist/_node-chunks/{chunk-7IE2RX52.js → chunk-KZ5LF3T5.js} +7 -7
- package/dist/_node-chunks/{chunk-Y5CAHPIS.js → chunk-RP6WLMKP.js} +6 -6
- package/dist/_node-chunks/{chunk-PTJW4VPH.js → chunk-V7LY2TOV.js} +9 -9
- package/dist/_node-chunks/chunk-XVEIRRY6.js +295 -0
- package/dist/manager.js +6 -9
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +21 -42
- package/dist/postinstall.js +24 -31
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +12 -15
- package/dist/vitest-plugin/test-utils.js +7 -10
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-J4SP23LA.js +0 -98
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.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-BH6F467E.js";
|
|
15
15
|
import {
|
|
16
16
|
join,
|
|
17
17
|
normalize,
|
|
18
18
|
relative,
|
|
19
19
|
resolve,
|
|
20
20
|
sep
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-KZ5LF3T5.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__name,
|
|
25
25
|
__require,
|
|
26
26
|
__toESM
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-RP6WLMKP.js";
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/braces/lib/utils.js
|
|
30
30
|
var require_utils = __commonJS({
|
|
@@ -3592,8 +3592,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3592
3592
|
staticDirs,
|
|
3593
3593
|
previewLevelTags,
|
|
3594
3594
|
core,
|
|
3595
|
-
extraOptimizeDeps
|
|
3596
|
-
features
|
|
3595
|
+
extraOptimizeDeps
|
|
3597
3596
|
] = await Promise.all([
|
|
3598
3597
|
getStoryGlobsAndFiles(presets, directories),
|
|
3599
3598
|
presets.apply("framework", void 0),
|
|
@@ -3602,8 +3601,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3602
3601
|
presets.apply("staticDirs", []),
|
|
3603
3602
|
extractTagsFromPreview(finalOptions.configDir),
|
|
3604
3603
|
presets.apply("core"),
|
|
3605
|
-
presets.apply("optimizeViteDeps", [])
|
|
3606
|
-
presets.apply("features", {})
|
|
3604
|
+
presets.apply("optimizeViteDeps", [])
|
|
3607
3605
|
]);
|
|
3608
3606
|
const pluginsToIgnore = [
|
|
3609
3607
|
"storybook:react-docgen-plugin",
|
|
@@ -3733,8 +3731,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3733
3731
|
]
|
|
3734
3732
|
},
|
|
3735
3733
|
define: {
|
|
3736
|
-
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3737
|
-
FEATURES: JSON.stringify(features)
|
|
3734
|
+
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3738
3735
|
}
|
|
3739
3736
|
};
|
|
3740
3737
|
const config = mergeConfig(
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
} from "../_browser-chunks/chunk-JK72E6FR.js";
|
|
4
4
|
|
|
5
5
|
// src/vitest-plugin/test-utils.ts
|
|
6
|
-
import { getStoryChildren, isStory } from "storybook/internal/csf";
|
|
7
6
|
import { server } from "@vitest/browser/context";
|
|
8
7
|
import { composeStory, getCsfFactoryAnnotations } from "storybook/preview-api";
|
|
9
8
|
|
|
@@ -54,15 +53,15 @@ var setViewport = /* @__PURE__ */ __name(async (parameters = {}, globals = {}) =
|
|
|
54
53
|
if (!page || !globalThis.__vitest_browser__) {
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
|
-
const
|
|
56
|
+
const viewports = {
|
|
58
57
|
...MINIMAL_VIEWPORTS,
|
|
59
58
|
...viewportsParam.viewports,
|
|
60
59
|
...viewportsParam.options
|
|
61
60
|
};
|
|
62
61
|
let viewportWidth = DEFAULT_VIEWPORT_DIMENSIONS.width;
|
|
63
62
|
let viewportHeight = DEFAULT_VIEWPORT_DIMENSIONS.height;
|
|
64
|
-
if (defaultViewport && defaultViewport in
|
|
65
|
-
const
|
|
63
|
+
if (defaultViewport && defaultViewport in viewports) {
|
|
64
|
+
const styles = viewports[defaultViewport].styles;
|
|
66
65
|
if (styles?.width && styles?.height) {
|
|
67
66
|
const { width, height } = styles;
|
|
68
67
|
viewportWidth = parseDimension(width, "width");
|
|
@@ -79,13 +78,11 @@ var convertToFilePath = /* @__PURE__ */ __name((url) => {
|
|
|
79
78
|
const normalizedPath = path.replace(/^\/+([a-zA-Z]:)/, "$1");
|
|
80
79
|
return normalizedPath.replace(/%20/g, " ");
|
|
81
80
|
}, "convertToFilePath");
|
|
82
|
-
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags
|
|
81
|
+
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
83
82
|
return async (context) => {
|
|
84
83
|
const annotations = getCsfFactoryAnnotations(story, meta);
|
|
85
|
-
const test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0;
|
|
86
|
-
const storyAnnotations = test ? test.input : annotations.story;
|
|
87
84
|
const composedStory = composeStory(
|
|
88
|
-
|
|
85
|
+
annotations.story,
|
|
89
86
|
annotations.meta,
|
|
90
87
|
{ initialGlobals: await getInitialGlobals?.() ?? {} },
|
|
91
88
|
annotations.preview ?? globalThis.globalProjectAnnotations,
|
|
@@ -96,9 +93,9 @@ var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags, story
|
|
|
96
93
|
}
|
|
97
94
|
context.story = composedStory;
|
|
98
95
|
const _task = context.task;
|
|
99
|
-
_task.meta.storyId =
|
|
96
|
+
_task.meta.storyId = composedStory.id;
|
|
100
97
|
await setViewport(composedStory.parameters, composedStory.globals);
|
|
101
|
-
await composedStory.run(
|
|
98
|
+
await composedStory.run();
|
|
102
99
|
_task.meta.reports = composedStory.reporting.reports;
|
|
103
100
|
};
|
|
104
101
|
}, "testStory");
|
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-32412-sha-f670336d",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@storybook/global": "^5.0.0",
|
|
76
|
-
"@storybook/icons": "^1.
|
|
76
|
+
"@storybook/icons": "^1.4.0",
|
|
77
77
|
"prompts": "^2.4.0",
|
|
78
78
|
"ts-dedent": "^2.2.0"
|
|
79
79
|
},
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"@vitest/browser": "^3.2.4",
|
|
86
86
|
"@vitest/runner": "^3.2.4",
|
|
87
87
|
"boxen": "^8.0.1",
|
|
88
|
-
"empathic": "^2.0.0",
|
|
89
88
|
"es-toolkit": "^1.36.0",
|
|
90
89
|
"execa": "^8.0.1",
|
|
90
|
+
"find-up": "^7.0.0",
|
|
91
91
|
"istanbul-lib-report": "^3.0.1",
|
|
92
92
|
"micromatch": "^4.0.8",
|
|
93
93
|
"pathe": "^1.1.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@vitest/browser": "^3.0.0",
|
|
108
108
|
"@vitest/runner": "^3.0.0",
|
|
109
|
-
"storybook": "^0.0.0-pr-
|
|
109
|
+
"storybook": "^0.0.0-pr-32412-sha-f670336d",
|
|
110
110
|
"vitest": "^3.0.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_qtujn27gzq from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_qtujn27gzq from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_qtujn27gzq from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_qtujn27gzq.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_qtujn27gzq.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_qtujn27gzq.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "./chunk-Y5CAHPIS.js";
|
|
15
|
-
|
|
16
|
-
// src/utils.ts
|
|
17
|
-
function getAddonNames(mainConfig) {
|
|
18
|
-
const addons = mainConfig.addons || [];
|
|
19
|
-
const addonList = addons.map((addon) => {
|
|
20
|
-
let name = "";
|
|
21
|
-
if (typeof addon === "string") {
|
|
22
|
-
name = addon;
|
|
23
|
-
} else if (typeof addon === "object") {
|
|
24
|
-
name = addon.name;
|
|
25
|
-
}
|
|
26
|
-
return name;
|
|
27
|
-
});
|
|
28
|
-
return addonList.filter((item) => item != null);
|
|
29
|
-
}
|
|
30
|
-
__name(getAddonNames, "getAddonNames");
|
|
31
|
-
function errorToErrorLike(error) {
|
|
32
|
-
return {
|
|
33
|
-
message: error.message,
|
|
34
|
-
name: error.name,
|
|
35
|
-
// avoid duplicating the error message in the stack trace
|
|
36
|
-
stack: error.stack?.replace(error.message, ""),
|
|
37
|
-
cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
__name(errorToErrorLike, "errorToErrorLike");
|
|
41
|
-
|
|
42
|
-
// ../../node_modules/empathic/find.mjs
|
|
43
|
-
import { join as join2 } from "node:path";
|
|
44
|
-
import { existsSync, statSync } from "node:fs";
|
|
45
|
-
|
|
46
|
-
// ../../node_modules/empathic/walk.mjs
|
|
47
|
-
import { dirname } from "node:path";
|
|
48
|
-
|
|
49
|
-
// ../../node_modules/empathic/resolve.mjs
|
|
50
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
51
|
-
function absolute(input, root) {
|
|
52
|
-
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
53
|
-
}
|
|
54
|
-
__name(absolute, "absolute");
|
|
55
|
-
|
|
56
|
-
// ../../node_modules/empathic/walk.mjs
|
|
57
|
-
function up(base, options) {
|
|
58
|
-
let { last, cwd } = options || {};
|
|
59
|
-
let tmp = absolute(base, cwd);
|
|
60
|
-
let root = absolute(last || "/", cwd);
|
|
61
|
-
let prev, arr = [];
|
|
62
|
-
while (prev !== root) {
|
|
63
|
-
arr.push(tmp);
|
|
64
|
-
tmp = dirname(prev = tmp);
|
|
65
|
-
if (tmp === prev) break;
|
|
66
|
-
}
|
|
67
|
-
return arr;
|
|
68
|
-
}
|
|
69
|
-
__name(up, "up");
|
|
70
|
-
|
|
71
|
-
// ../../node_modules/empathic/find.mjs
|
|
72
|
-
function up2(name, options) {
|
|
73
|
-
let dir, tmp;
|
|
74
|
-
let start = options && options.cwd || "";
|
|
75
|
-
for (dir of up(start, options)) {
|
|
76
|
-
tmp = join2(dir, name);
|
|
77
|
-
if (existsSync(tmp)) return tmp;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
__name(up2, "up");
|
|
81
|
-
function any(names, options) {
|
|
82
|
-
let dir, start = options && options.cwd || "";
|
|
83
|
-
let j = 0, len = names.length, tmp;
|
|
84
|
-
for (dir of up(start, options)) {
|
|
85
|
-
for (j = 0; j < len; j++) {
|
|
86
|
-
tmp = join2(dir, names[j]);
|
|
87
|
-
if (existsSync(tmp)) return tmp;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
__name(any, "any");
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
getAddonNames,
|
|
95
|
-
errorToErrorLike,
|
|
96
|
-
up2 as up,
|
|
97
|
-
any
|
|
98
|
-
};
|