@storybook/addon-vitest 10.0.0-beta.6 → 10.0.0-beta.7
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-W34P2AWY.js → chunk-BGPEEFPC.js} +6 -6
- package/dist/_node-chunks/{chunk-OTJIME4I.js → chunk-BIQEIS7L.js} +8 -8
- package/dist/_node-chunks/{chunk-ZOV2V4R2.js → chunk-GN6HGKYD.js} +7 -7
- package/dist/_node-chunks/{chunk-NUDB275Q.js → chunk-HJJBE5UQ.js} +7 -7
- package/dist/_node-chunks/{chunk-GUHYTLWS.js → chunk-L5DBSCFS.js} +7 -7
- package/dist/_node-chunks/{chunk-4ODWEZZ6.js → chunk-MA45NU4I.js} +9 -9
- package/dist/_node-chunks/{chunk-GGPSQDLA.js → chunk-OPH3AWZV.js} +6 -6
- package/dist/_node-chunks/{chunk-PAVNRHXA.js → chunk-UIR7UYAJ.js} +7 -7
- package/dist/manager.js +9 -6
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +38 -16
- package/dist/postinstall.js +12 -12
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +15 -12
- package/dist/vitest-plugin/test-utils.js +10 -7
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,13 +12,13 @@ var require = CJS_COMPAT_NODE_MODULE_z9ub594f67.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GN6HGKYD.js";
|
|
16
16
|
import {
|
|
17
17
|
__commonJS,
|
|
18
18
|
__name,
|
|
19
19
|
__require,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BGPEEFPC.js";
|
|
22
22
|
|
|
23
23
|
// ../../node_modules/isexe/windows.js
|
|
24
24
|
var require_windows = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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
|
__name
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BGPEEFPC.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
17
17
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_z9ub594f67.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BGPEEFPC.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/picocolors/picocolors.js
|
|
18
18
|
var require_picocolors = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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
|
__name
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BGPEEFPC.js";
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
function getAddonNames(mainConfig) {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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
|
ADDON_ID
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OPH3AWZV.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HJJBE5UQ.js";
|
|
18
18
|
import {
|
|
19
19
|
__name,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BGPEEFPC.js";
|
|
22
22
|
|
|
23
23
|
// src/logger.ts
|
|
24
24
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_z9ub594f67.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BGPEEFPC.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/semver/internal/constants.js
|
|
18
18
|
var require_constants = __commonJS({
|
package/dist/manager.js
CHANGED
|
@@ -702,13 +702,16 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
702
702
|
{
|
|
703
703
|
"aria-label": "Start test run",
|
|
704
704
|
size: "medium",
|
|
705
|
-
onClick: () =>
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
storyIds
|
|
709
|
-
triggeredBy: entry ? entry.type : "global"
|
|
705
|
+
onClick: () => {
|
|
706
|
+
let storyIds;
|
|
707
|
+
if (entry) {
|
|
708
|
+
storyIds = entry.type === "story" ? [entry.id] : api.findAllLeafStoryIds(entry.id);
|
|
710
709
|
}
|
|
711
|
-
|
|
710
|
+
store.send({
|
|
711
|
+
type: "TRIGGER_RUN",
|
|
712
|
+
payload: { storyIds, triggeredBy: entry?.type ?? "global" }
|
|
713
|
+
});
|
|
714
|
+
}
|
|
712
715
|
},
|
|
713
716
|
React3.createElement(PlayHollowIcon, null)
|
|
714
717
|
)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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_gte
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-UIR7UYAJ.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__name,
|
|
18
18
|
__require,
|
|
19
19
|
__toESM
|
|
20
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-BGPEEFPC.js";
|
|
21
21
|
|
|
22
22
|
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
23
23
|
var require_make_dir = __commonJS({
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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
|
log
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-MA45NU4I.js";
|
|
15
15
|
import {
|
|
16
16
|
any,
|
|
17
17
|
errorToErrorLike
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
18
|
+
} from "../_node-chunks/chunk-L5DBSCFS.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID,
|
|
21
21
|
COVERAGE_DIRECTORY,
|
|
22
22
|
STATUS_TYPE_ID_A11Y,
|
|
23
23
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
24
24
|
storeOptions
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
26
|
-
import "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-OPH3AWZV.js";
|
|
26
|
+
import "../_node-chunks/chunk-HJJBE5UQ.js";
|
|
27
27
|
import {
|
|
28
28
|
dirname,
|
|
29
29
|
join,
|
|
30
30
|
normalize,
|
|
31
31
|
path
|
|
32
|
-
} from "../_node-chunks/chunk-
|
|
32
|
+
} from "../_node-chunks/chunk-GN6HGKYD.js";
|
|
33
33
|
import {
|
|
34
34
|
__name
|
|
35
|
-
} from "../_node-chunks/chunk-
|
|
35
|
+
} from "../_node-chunks/chunk-BGPEEFPC.js";
|
|
36
36
|
|
|
37
37
|
// src/node/vitest.ts
|
|
38
38
|
import process2 from "node:process";
|
|
@@ -242,6 +242,8 @@ var StorybookReporter = class {
|
|
|
242
242
|
var VITEST_CONFIG_FILE_EXTENSIONS = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"];
|
|
243
243
|
var VITEST_WORKSPACE_FILE_EXTENSION = ["ts", "js", "json"];
|
|
244
244
|
process.env.VITEST_STORYBOOK = "true";
|
|
245
|
+
var DOUBLE_SPACES = " ";
|
|
246
|
+
var getTestName = /* @__PURE__ */ __name((name) => `${name}${DOUBLE_SPACES}`, "getTestName");
|
|
245
247
|
var VitestManager = class {
|
|
246
248
|
constructor(testManager) {
|
|
247
249
|
this.testManager = testManager;
|
|
@@ -432,16 +434,36 @@ Please install the @vitest/${coveragePackage} package to collect coverage
|
|
|
432
434
|
this.resetGlobalTestNamePattern();
|
|
433
435
|
await this.cancelCurrentRun();
|
|
434
436
|
const testSpecifications = await this.getStorybookTestSpecifications();
|
|
435
|
-
const
|
|
437
|
+
const allStories = await this.fetchStories();
|
|
438
|
+
const filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
436
439
|
const isSingleStoryRun = runPayload.storyIds?.length === 1;
|
|
437
440
|
if (isSingleStoryRun) {
|
|
438
|
-
const
|
|
439
|
-
|
|
441
|
+
const selectedStory = filteredStories.find((story) => story.id === runPayload.storyIds?.[0]);
|
|
442
|
+
if (!selectedStory) {
|
|
443
|
+
throw new Error(`Story ${runPayload.storyIds?.[0]} not found`);
|
|
444
|
+
}
|
|
445
|
+
const storyName = selectedStory.name;
|
|
446
|
+
let regex;
|
|
447
|
+
const isParentStory = allStories.some((story) => selectedStory.id === story.parent);
|
|
448
|
+
const hasParentStory = allStories.some((story) => selectedStory.parent === story.id);
|
|
449
|
+
if (isParentStory) {
|
|
450
|
+
const parentName = getTestName(selectedStory.name);
|
|
451
|
+
regex = new RegExp(`^${parentName}`);
|
|
452
|
+
} else if (hasParentStory) {
|
|
453
|
+
const parentStory = allStories.find((story) => story.id === selectedStory.parent);
|
|
454
|
+
if (!parentStory) {
|
|
455
|
+
throw new Error(`Parent story not found for story ${selectedStory.id}`);
|
|
456
|
+
}
|
|
457
|
+
const parentName = getTestName(parentStory.name);
|
|
458
|
+
regex = new RegExp(`^${parentName} ${storyName}$`);
|
|
459
|
+
} else {
|
|
460
|
+
regex = new RegExp(`^${storyName}$`);
|
|
461
|
+
}
|
|
440
462
|
this.vitest.setGlobalTestNamePattern(regex);
|
|
441
463
|
}
|
|
442
464
|
const { filteredTestSpecifications, filteredStoryIds } = this.filterTestSpecifications(
|
|
443
465
|
testSpecifications,
|
|
444
|
-
|
|
466
|
+
filteredStories
|
|
445
467
|
);
|
|
446
468
|
this.testManager.store.setState((s) => ({
|
|
447
469
|
...s,
|
package/dist/postinstall.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,22 +12,22 @@ var require = CJS_COMPAT_NODE_MODULE_z9ub594f67.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
execa,
|
|
14
14
|
resolvePackageDir
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-BIQEIS7L.js";
|
|
16
16
|
import {
|
|
17
17
|
any,
|
|
18
18
|
getAddonNames,
|
|
19
19
|
up
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-L5DBSCFS.js";
|
|
21
21
|
import {
|
|
22
22
|
DOCUMENTATION_LINK,
|
|
23
23
|
SUPPORTED_FRAMEWORKS
|
|
24
|
-
} from "./_node-chunks/chunk-
|
|
24
|
+
} from "./_node-chunks/chunk-OPH3AWZV.js";
|
|
25
25
|
import {
|
|
26
26
|
dirname,
|
|
27
27
|
join,
|
|
28
28
|
relative,
|
|
29
29
|
resolve
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-GN6HGKYD.js";
|
|
31
31
|
import {
|
|
32
32
|
require_compare,
|
|
33
33
|
require_constants,
|
|
@@ -37,12 +37,12 @@ import {
|
|
|
37
37
|
require_parse_options,
|
|
38
38
|
require_re,
|
|
39
39
|
require_semver
|
|
40
|
-
} from "./_node-chunks/chunk-
|
|
40
|
+
} from "./_node-chunks/chunk-UIR7UYAJ.js";
|
|
41
41
|
import {
|
|
42
42
|
__commonJS,
|
|
43
43
|
__name,
|
|
44
44
|
__toESM
|
|
45
|
-
} from "./_node-chunks/chunk-
|
|
45
|
+
} from "./_node-chunks/chunk-BGPEEFPC.js";
|
|
46
46
|
|
|
47
47
|
// ../../node_modules/semver/functions/parse.js
|
|
48
48
|
var require_parse = __commonJS({
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,11 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_z9ub594f67.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-MA45NU4I.js";
|
|
16
16
|
import {
|
|
17
17
|
execaNode,
|
|
18
18
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-BIQEIS7L.js";
|
|
20
20
|
import {
|
|
21
21
|
ADDON_ID,
|
|
22
22
|
COVERAGE_DIRECTORY,
|
|
@@ -25,17 +25,17 @@ import {
|
|
|
25
25
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
26
26
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
27
27
|
storeOptions
|
|
28
|
-
} from "./_node-chunks/chunk-
|
|
28
|
+
} from "./_node-chunks/chunk-OPH3AWZV.js";
|
|
29
29
|
import {
|
|
30
30
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
31
|
+
} from "./_node-chunks/chunk-HJJBE5UQ.js";
|
|
32
32
|
import {
|
|
33
33
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
34
|
+
} from "./_node-chunks/chunk-GN6HGKYD.js";
|
|
35
35
|
import {
|
|
36
36
|
__name,
|
|
37
37
|
__toESM
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-BGPEEFPC.js";
|
|
39
39
|
|
|
40
40
|
// src/preset.ts
|
|
41
41
|
import { mkdir } from "node:fs/promises";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
__name,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-BGPEEFPC.js";
|
|
18
18
|
|
|
19
19
|
// ../../node_modules/tree-kill/index.js
|
|
20
20
|
var require_tree_kill = __commonJS({
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_x69zvdiz0f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_x69zvdiz0f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_x69zvdiz0f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_x69zvdiz0f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_x69zvdiz0f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_x69zvdiz0f.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-HJJBE5UQ.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-GN6HGKYD.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-BGPEEFPC.js";
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/braces/lib/utils.js
|
|
30
30
|
var require_utils = __commonJS({
|
|
@@ -3592,7 +3592,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3592
3592
|
staticDirs,
|
|
3593
3593
|
previewLevelTags,
|
|
3594
3594
|
core,
|
|
3595
|
-
extraOptimizeDeps
|
|
3595
|
+
extraOptimizeDeps,
|
|
3596
|
+
features
|
|
3596
3597
|
] = await Promise.all([
|
|
3597
3598
|
getStoryGlobsAndFiles(presets, directories),
|
|
3598
3599
|
presets.apply("framework", void 0),
|
|
@@ -3601,7 +3602,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3601
3602
|
presets.apply("staticDirs", []),
|
|
3602
3603
|
extractTagsFromPreview(finalOptions.configDir),
|
|
3603
3604
|
presets.apply("core"),
|
|
3604
|
-
presets.apply("optimizeViteDeps", [])
|
|
3605
|
+
presets.apply("optimizeViteDeps", []),
|
|
3606
|
+
presets.apply("features", {})
|
|
3605
3607
|
]);
|
|
3606
3608
|
const pluginsToIgnore = [
|
|
3607
3609
|
"storybook:react-docgen-plugin",
|
|
@@ -3731,7 +3733,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3731
3733
|
]
|
|
3732
3734
|
},
|
|
3733
3735
|
define: {
|
|
3734
|
-
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3736
|
+
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {},
|
|
3737
|
+
FEATURES: JSON.stringify(features)
|
|
3735
3738
|
}
|
|
3736
3739
|
};
|
|
3737
3740
|
const config = mergeConfig(
|
|
@@ -3,6 +3,7 @@ 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";
|
|
6
7
|
import { server } from "@vitest/browser/context";
|
|
7
8
|
import { composeStory, getCsfFactoryAnnotations } from "storybook/preview-api";
|
|
8
9
|
|
|
@@ -53,15 +54,15 @@ var setViewport = /* @__PURE__ */ __name(async (parameters = {}, globals = {}) =
|
|
|
53
54
|
if (!page || !globalThis.__vitest_browser__) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
const
|
|
57
|
+
const options = {
|
|
57
58
|
...MINIMAL_VIEWPORTS,
|
|
58
59
|
...viewportsParam.viewports,
|
|
59
60
|
...viewportsParam.options
|
|
60
61
|
};
|
|
61
62
|
let viewportWidth = DEFAULT_VIEWPORT_DIMENSIONS.width;
|
|
62
63
|
let viewportHeight = DEFAULT_VIEWPORT_DIMENSIONS.height;
|
|
63
|
-
if (defaultViewport && defaultViewport in
|
|
64
|
-
const styles =
|
|
64
|
+
if (defaultViewport && defaultViewport in options) {
|
|
65
|
+
const { styles } = options[defaultViewport];
|
|
65
66
|
if (styles?.width && styles?.height) {
|
|
66
67
|
const { width, height } = styles;
|
|
67
68
|
viewportWidth = parseDimension(width, "width");
|
|
@@ -78,11 +79,13 @@ var convertToFilePath = /* @__PURE__ */ __name((url) => {
|
|
|
78
79
|
const normalizedPath = path.replace(/^\/+([a-zA-Z]:)/, "$1");
|
|
79
80
|
return normalizedPath.replace(/%20/g, " ");
|
|
80
81
|
}, "convertToFilePath");
|
|
81
|
-
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
82
|
+
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags, storyId, testName) => {
|
|
82
83
|
return async (context) => {
|
|
83
84
|
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;
|
|
84
87
|
const composedStory = composeStory(
|
|
85
|
-
|
|
88
|
+
storyAnnotations,
|
|
86
89
|
annotations.meta,
|
|
87
90
|
{ initialGlobals: await getInitialGlobals?.() ?? {} },
|
|
88
91
|
annotations.preview ?? globalThis.globalProjectAnnotations,
|
|
@@ -93,9 +96,9 @@ var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
|
93
96
|
}
|
|
94
97
|
context.story = composedStory;
|
|
95
98
|
const _task = context.task;
|
|
96
|
-
_task.meta.storyId =
|
|
99
|
+
_task.meta.storyId = storyId;
|
|
97
100
|
await setViewport(composedStory.parameters, composedStory.globals);
|
|
98
|
-
await composedStory.run();
|
|
101
|
+
await composedStory.run(void 0);
|
|
99
102
|
_task.meta.reports = composedStory.reporting.reports;
|
|
100
103
|
};
|
|
101
104
|
}, "testStory");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.7",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@vitest/browser": "^3.0.0",
|
|
108
108
|
"@vitest/runner": "^3.0.0",
|
|
109
|
-
"storybook": "^10.0.0-beta.
|
|
109
|
+
"storybook": "^10.0.0-beta.7",
|
|
110
110
|
"vitest": "^3.0.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|