@storybook/addon-vitest 10.4.0-alpha.11 → 10.4.0-alpha.13
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-FP6EVVC6.js → chunk-OHAJYSSA.js} +6 -2
- package/dist/_node-chunks/{chunk-2GGPV6RL.js → chunk-4L2EC3M2.js} +6 -6
- package/dist/_node-chunks/{chunk-LOJFC6WB.js → chunk-A547SDFI.js} +11 -7
- package/dist/_node-chunks/{chunk-6267M2TA.js → chunk-GYHEIW4A.js} +7 -7
- package/dist/_node-chunks/{chunk-3PU66CME.js → chunk-JW5BT6WZ.js} +6 -6
- package/dist/_node-chunks/{chunk-M346CYJL.js → chunk-MJGFRMWT.js} +7 -7
- package/dist/_node-chunks/{chunk-PXU54O6X.js → chunk-U7LRX24F.js} +6 -6
- package/dist/_node-chunks/{chunk-Y2DRY4WC.js → chunk-VOW3K2GU.js} +11 -11
- package/dist/_node-chunks/{chunk-YG4TBQOB.js → chunk-WYWXUN7N.js} +7 -7
- package/dist/_node-chunks/{vitest.config.3.2.template-Z6RDHBJR.js → vitest.config.3.2.template-EIQAXJPU.js} +7 -7
- package/dist/_node-chunks/{vitest.config.4.template-RSD3EYC2.js → vitest.config.4.template-TX4N3NT4.js} +7 -7
- package/dist/_node-chunks/{vitest.config.template-FCHZHKX5.js → vitest.config.template-D5MYWETW.js} +7 -7
- package/dist/_node-chunks/{vitest.workspace.template-2PIJLBP5.js → vitest.workspace.template-GFBFW5FF.js} +7 -7
- package/dist/constants.d.ts +15 -23
- package/dist/constants.js +14 -8
- package/dist/manager.js +1 -1
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +52 -27
- package/dist/postinstall.js +18 -18
- package/dist/preset.js +18 -18
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +81 -26
- package/dist/vitest-plugin/setup-file.js +1 -1
- package/dist/vitest-plugin/test-utils.js +40 -4
- package/package.json +3 -3
|
@@ -30,6 +30,7 @@ var storeOptions = {
|
|
|
30
30
|
componentTestStatuses: [],
|
|
31
31
|
a11yStatuses: [],
|
|
32
32
|
a11yReports: {},
|
|
33
|
+
reports: {},
|
|
33
34
|
componentTestCount: {
|
|
34
35
|
success: 0,
|
|
35
36
|
error: 0
|
|
@@ -48,7 +49,7 @@ var storeOptions = {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
}, FULL_RUN_TRIGGERS = ["global", "run-all"], STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`;
|
|
51
|
-
var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
|
|
52
|
+
var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", STORYBOOK_TEST_PROVIDE_KEY = "storybook/test-provided", STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY = "storybook/core-ghost-stories", STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY = "storybook/core-render-analysis", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
|
|
52
53
|
|
|
53
54
|
export {
|
|
54
55
|
PANEL_ID,
|
|
@@ -61,5 +62,8 @@ export {
|
|
|
61
62
|
storeOptions,
|
|
62
63
|
FULL_RUN_TRIGGERS,
|
|
63
64
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
64
|
-
STATUS_TYPE_ID_A11Y
|
|
65
|
+
STATUS_TYPE_ID_A11Y,
|
|
66
|
+
STORYBOOK_TEST_PROVIDE_KEY,
|
|
67
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
68
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY
|
|
65
69
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -40,6 +40,7 @@ var ADDON_ID3 = "storybook/test", TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider
|
|
|
40
40
|
componentTestStatuses: [],
|
|
41
41
|
a11yStatuses: [],
|
|
42
42
|
a11yReports: {},
|
|
43
|
+
reports: {},
|
|
43
44
|
componentTestCount: {
|
|
44
45
|
success: 0,
|
|
45
46
|
error: 0
|
|
@@ -57,7 +58,7 @@ var ADDON_ID3 = "storybook/test", TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider
|
|
|
57
58
|
coverageSummary: void 0
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
}, FULL_RUN_TRIGGERS = ["global", "run-all"], STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`, STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status", TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider", STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
|
|
61
|
+
}, FULL_RUN_TRIGGERS = ["global", "run-all"], STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`, STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status", TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider", STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", STORYBOOK_TEST_PROVIDE_KEY = "storybook/test-provided", STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY = "storybook/core-ghost-stories", STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY = "storybook/core-render-analysis", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
|
|
61
62
|
|
|
62
63
|
export {
|
|
63
64
|
PANEL_ID,
|
|
@@ -77,6 +78,9 @@ export {
|
|
|
77
78
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
78
79
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
79
80
|
STATUS_TYPE_ID_A11Y,
|
|
81
|
+
STORYBOOK_TEST_PROVIDE_KEY,
|
|
82
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
83
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
80
84
|
TRIGGER_TEST_RUN_REQUEST,
|
|
81
85
|
TRIGGER_TEST_RUN_RESPONSE
|
|
82
86
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4L2EC3M2.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4L2EC3M2.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
ADDON_ID2 as ADDON_ID
|
|
14
|
-
} from "./chunk-LOJFC6WB.js";
|
|
15
12
|
import {
|
|
16
13
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MJGFRMWT.js";
|
|
15
|
+
import {
|
|
16
|
+
ADDON_ID2 as ADDON_ID
|
|
17
|
+
} from "./chunk-A547SDFI.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4L2EC3M2.js";
|
|
21
21
|
|
|
22
22
|
// src/logger.ts
|
|
23
23
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4L2EC3M2.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4L2EC3M2.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.3.2.template.ts
|
|
15
15
|
var vitest_config_3_2_template_default = `import path from 'node:path';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4L2EC3M2.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.4.template.ts
|
|
15
15
|
var vitest_config_4_template_default = `import path from 'node:path';
|
package/dist/_node-chunks/{vitest.config.template-FCHZHKX5.js → vitest.config.template-D5MYWETW.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4L2EC3M2.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.template.ts
|
|
15
15
|
var vitest_config_template_default = `import path from 'node:path';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4L2EC3M2.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.workspace.template.ts
|
|
15
15
|
var vitest_workspace_template_default = `import path from 'node:path';
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { API_HashEntry,
|
|
1
|
+
import { API_HashEntry, Status, StoryId } from 'storybook/internal/types';
|
|
2
|
+
import { Report } from 'storybook/preview-api';
|
|
2
3
|
|
|
3
|
-
type A11yReport = any;
|
|
4
4
|
interface VitestError extends Error {
|
|
5
5
|
VITEST_TEST_PATH?: string;
|
|
6
6
|
VITEST_TEST_NAME?: string;
|
|
@@ -17,10 +17,12 @@ type ErrorLike = {
|
|
|
17
17
|
stack?: string;
|
|
18
18
|
cause?: ErrorLike;
|
|
19
19
|
};
|
|
20
|
+
type RunConfig = Record<string, unknown>;
|
|
20
21
|
type RunTrigger = 'run-all' | 'global' | 'watch' | Extract<API_HashEntry['type'], string> | `external:${string}`;
|
|
22
|
+
type A11yRunReport = Report['result'];
|
|
21
23
|
type CurrentRun = {
|
|
22
24
|
triggeredBy: RunTrigger | undefined;
|
|
23
|
-
config:
|
|
25
|
+
config: RunConfig;
|
|
24
26
|
componentTestStatuses: Status[];
|
|
25
27
|
a11yStatuses: Status[];
|
|
26
28
|
componentTestCount: {
|
|
@@ -32,7 +34,8 @@ type CurrentRun = {
|
|
|
32
34
|
warning: number;
|
|
33
35
|
error: number;
|
|
34
36
|
};
|
|
35
|
-
a11yReports: Record<StoryId,
|
|
37
|
+
a11yReports: Record<StoryId, A11yRunReport[]>;
|
|
38
|
+
reports: Record<StoryId, Report[]>;
|
|
36
39
|
totalTestCount: number | undefined;
|
|
37
40
|
storyIds: StoryId[] | undefined;
|
|
38
41
|
startedAt: number | undefined;
|
|
@@ -43,21 +46,6 @@ type CurrentRun = {
|
|
|
43
46
|
percentage: number;
|
|
44
47
|
} | undefined;
|
|
45
48
|
};
|
|
46
|
-
type StoreState = {
|
|
47
|
-
config: {
|
|
48
|
-
coverage: boolean;
|
|
49
|
-
a11y: boolean;
|
|
50
|
-
};
|
|
51
|
-
watching: boolean;
|
|
52
|
-
cancelling: boolean;
|
|
53
|
-
index: StoryIndex;
|
|
54
|
-
previewAnnotations: PreviewAnnotation[];
|
|
55
|
-
fatalError: {
|
|
56
|
-
message: string | undefined;
|
|
57
|
-
error: ErrorLike;
|
|
58
|
-
} | undefined;
|
|
59
|
-
currentRun: CurrentRun;
|
|
60
|
-
};
|
|
61
49
|
|
|
62
50
|
declare const PANEL_ID$1 = "storybook/interactions/panel";
|
|
63
51
|
|
|
@@ -89,12 +77,13 @@ declare const storeOptions: {
|
|
|
89
77
|
currentRun: {
|
|
90
78
|
triggeredBy: undefined;
|
|
91
79
|
config: {
|
|
92
|
-
coverage:
|
|
93
|
-
a11y:
|
|
80
|
+
coverage: boolean;
|
|
81
|
+
a11y: boolean;
|
|
94
82
|
};
|
|
95
83
|
componentTestStatuses: never[];
|
|
96
84
|
a11yStatuses: never[];
|
|
97
85
|
a11yReports: {};
|
|
86
|
+
reports: {};
|
|
98
87
|
componentTestCount: {
|
|
99
88
|
success: number;
|
|
100
89
|
error: number;
|
|
@@ -119,13 +108,16 @@ declare const STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/statu
|
|
|
119
108
|
declare const TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider";
|
|
120
109
|
declare const STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test";
|
|
121
110
|
declare const STATUS_TYPE_ID_A11Y = "storybook/a11y";
|
|
111
|
+
declare const STORYBOOK_TEST_PROVIDE_KEY = "storybook/test-provided";
|
|
112
|
+
declare const STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY = "storybook/core-ghost-stories";
|
|
113
|
+
declare const STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY = "storybook/core-render-analysis";
|
|
122
114
|
declare const TRIGGER_TEST_RUN_REQUEST = "storybook/test/trigger-test-run-request";
|
|
123
115
|
declare const TRIGGER_TEST_RUN_RESPONSE = "storybook/test/trigger-test-run-response";
|
|
124
116
|
type TriggerTestRunRequestPayload = {
|
|
125
117
|
requestId: string;
|
|
126
118
|
actor: string;
|
|
127
119
|
storyIds?: string[];
|
|
128
|
-
config?:
|
|
120
|
+
config?: Record<string, unknown>;
|
|
129
121
|
};
|
|
130
122
|
type TestRunResult = CurrentRun;
|
|
131
123
|
type TriggerTestRunResponsePayload = {
|
|
@@ -138,4 +130,4 @@ type TriggerTestRunResponsePayload = {
|
|
|
138
130
|
};
|
|
139
131
|
};
|
|
140
132
|
|
|
141
|
-
export { ADDON_ID$1 as A11Y_ADDON_ID, PANEL_ID as A11Y_PANEL_ID, ADDON_ID, PANEL_ID$1 as COMPONENT_TESTING_PANEL_ID, COVERAGE_DIRECTORY, DOCUMENTATION_FATAL_ERROR_LINK, DOCUMENTATION_LINK, FULL_RUN_TRIGGERS, STATUS_STORE_CHANNEL_EVENT_NAME, STATUS_TYPE_ID_A11Y, STATUS_TYPE_ID_COMPONENT_TEST, STORE_CHANNEL_EVENT_NAME, STORYBOOK_ADDON_TEST_CHANNEL, TEST_PROVIDER_ID, TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME, TRIGGER_TEST_RUN_REQUEST, TRIGGER_TEST_RUN_RESPONSE, TUTORIAL_VIDEO_LINK, type TestRunResult, type TriggerTestRunRequestPayload, type TriggerTestRunResponsePayload, storeOptions };
|
|
133
|
+
export { ADDON_ID$1 as A11Y_ADDON_ID, PANEL_ID as A11Y_PANEL_ID, ADDON_ID, PANEL_ID$1 as COMPONENT_TESTING_PANEL_ID, COVERAGE_DIRECTORY, DOCUMENTATION_FATAL_ERROR_LINK, DOCUMENTATION_LINK, FULL_RUN_TRIGGERS, STATUS_STORE_CHANNEL_EVENT_NAME, STATUS_TYPE_ID_A11Y, STATUS_TYPE_ID_COMPONENT_TEST, STORE_CHANNEL_EVENT_NAME, STORYBOOK_ADDON_TEST_CHANNEL, STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY, STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY, STORYBOOK_TEST_PROVIDE_KEY, TEST_PROVIDER_ID, TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME, TRIGGER_TEST_RUN_REQUEST, TRIGGER_TEST_RUN_RESPONSE, TUTORIAL_VIDEO_LINK, type TestRunResult, type TriggerTestRunRequestPayload, type TriggerTestRunResponsePayload, storeOptions };
|
package/dist/constants.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -23,14 +23,17 @@ import {
|
|
|
23
23
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
24
24
|
STORE_CHANNEL_EVENT_NAME,
|
|
25
25
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
26
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
27
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
28
|
+
STORYBOOK_TEST_PROVIDE_KEY,
|
|
26
29
|
TEST_PROVIDER_ID,
|
|
27
30
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
28
31
|
TRIGGER_TEST_RUN_REQUEST,
|
|
29
32
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
30
33
|
TUTORIAL_VIDEO_LINK,
|
|
31
34
|
storeOptions
|
|
32
|
-
} from "./_node-chunks/chunk-
|
|
33
|
-
import "./_node-chunks/chunk-
|
|
35
|
+
} from "./_node-chunks/chunk-A547SDFI.js";
|
|
36
|
+
import "./_node-chunks/chunk-4L2EC3M2.js";
|
|
34
37
|
export {
|
|
35
38
|
ADDON_ID as A11Y_ADDON_ID,
|
|
36
39
|
PANEL_ID2 as A11Y_PANEL_ID,
|
|
@@ -45,6 +48,9 @@ export {
|
|
|
45
48
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
46
49
|
STORE_CHANNEL_EVENT_NAME,
|
|
47
50
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
51
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
52
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
53
|
+
STORYBOOK_TEST_PROVIDE_KEY,
|
|
48
54
|
TEST_PROVIDER_ID,
|
|
49
55
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
50
56
|
TRIGGER_TEST_RUN_REQUEST,
|
package/dist/manager.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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-GYHEIW4A.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-4L2EC3M2.js";
|
|
20
20
|
|
|
21
21
|
// ../../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
22
22
|
var require_make_dir = __commonJS({
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,27 +12,28 @@ var require = CJS_COMPAT_NODE_MODULE_yl57dczpwb.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
errorToErrorLike,
|
|
14
14
|
log
|
|
15
|
-
} from "../_node-chunks/chunk-
|
|
15
|
+
} from "../_node-chunks/chunk-VOW3K2GU.js";
|
|
16
16
|
import {
|
|
17
17
|
any,
|
|
18
18
|
up
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
20
|
-
import
|
|
21
|
-
ADDON_ID2 as ADDON_ID,
|
|
22
|
-
COVERAGE_DIRECTORY,
|
|
23
|
-
STATUS_TYPE_ID_A11Y,
|
|
24
|
-
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
25
|
-
storeOptions
|
|
26
|
-
} from "../_node-chunks/chunk-LOJFC6WB.js";
|
|
27
|
-
import "../_node-chunks/chunk-M346CYJL.js";
|
|
19
|
+
} from "../_node-chunks/chunk-JW5BT6WZ.js";
|
|
20
|
+
import "../_node-chunks/chunk-MJGFRMWT.js";
|
|
28
21
|
import {
|
|
29
22
|
dirname,
|
|
30
23
|
join,
|
|
31
24
|
normalize,
|
|
32
25
|
path,
|
|
33
26
|
resolve
|
|
34
|
-
} from "../_node-chunks/chunk-
|
|
35
|
-
import
|
|
27
|
+
} from "../_node-chunks/chunk-U7LRX24F.js";
|
|
28
|
+
import {
|
|
29
|
+
ADDON_ID2 as ADDON_ID,
|
|
30
|
+
COVERAGE_DIRECTORY,
|
|
31
|
+
STATUS_TYPE_ID_A11Y,
|
|
32
|
+
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
33
|
+
STORYBOOK_TEST_PROVIDE_KEY,
|
|
34
|
+
storeOptions
|
|
35
|
+
} from "../_node-chunks/chunk-A547SDFI.js";
|
|
36
|
+
import "../_node-chunks/chunk-4L2EC3M2.js";
|
|
36
37
|
|
|
37
38
|
// src/node/vitest.ts
|
|
38
39
|
import process2 from "node:process";
|
|
@@ -205,7 +206,10 @@ var DOUBLE_SPACES = " ", getTestName = (name) => `${name}${DOUBLE_SPACES}`, Vit
|
|
|
205
206
|
}), vitestWorkspaceConfig, firstVitestConfig;
|
|
206
207
|
for (let location of potentialConfigFileLocations) {
|
|
207
208
|
for (let file of configFiles) {
|
|
208
|
-
let maybe = any([file], {
|
|
209
|
+
let maybe = any([file], {
|
|
210
|
+
cwd: location,
|
|
211
|
+
last: getProjectRoot()
|
|
212
|
+
});
|
|
209
213
|
if (maybe && existsSync(maybe)) {
|
|
210
214
|
firstVitestConfig ??= dirname(maybe);
|
|
211
215
|
let content = readFileSync(maybe, "utf8");
|
|
@@ -340,9 +344,15 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
340
344
|
}
|
|
341
345
|
return { filteredTestSpecifications, filteredStoryIds };
|
|
342
346
|
}
|
|
347
|
+
getCurrentRunConfig() {
|
|
348
|
+
return this.testManager.store.getState().currentRun.config;
|
|
349
|
+
}
|
|
350
|
+
provideRunConfig() {
|
|
351
|
+
this.vitest?.provide(STORYBOOK_TEST_PROVIDE_KEY, this.getCurrentRunConfig());
|
|
352
|
+
}
|
|
343
353
|
async runTests(runPayload) {
|
|
344
|
-
let { watching
|
|
345
|
-
this.vitest ? currentCoverage !== coverageShouldBeEnabled ? await this.restartVitest({ coverage: coverageShouldBeEnabled }) : await this.vitestRestartPromise : await this.startVitest({ coverage: coverageShouldBeEnabled }), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
354
|
+
let { watching } = this.testManager.store.getState(), coverageShouldBeEnabled = !!this.getCurrentRunConfig().coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0, currentCoverage = this.vitest?.config.coverage?.enabled;
|
|
355
|
+
this.vitest ? currentCoverage !== coverageShouldBeEnabled ? await this.restartVitest({ coverage: coverageShouldBeEnabled }) : await this.vitestRestartPromise : await this.startVitest({ coverage: coverageShouldBeEnabled }), this.provideRunConfig(), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
346
356
|
let testSpecifications = await this.getStorybookTestSpecifications(), allStories = this.getStories(), filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
347
357
|
if (runPayload.storyIds?.length) {
|
|
348
358
|
let regex = this.buildTestNamePatternForStories(filteredStories, allStories);
|
|
@@ -404,7 +414,7 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
404
414
|
...s.currentRun,
|
|
405
415
|
totalTestCount: filteredStoryIds.length
|
|
406
416
|
}
|
|
407
|
-
})), await this.vitest.cancelCurrentRun("keyboard-input"), await this.runningPromise, await this.vitest.runTestSpecifications(filteredTestSpecifications, !1);
|
|
417
|
+
})), await this.vitest.cancelCurrentRun("keyboard-input"), await this.runningPromise, this.provideRunConfig(), await this.vitest.runTestSpecifications(filteredTestSpecifications, !1);
|
|
408
418
|
}
|
|
409
419
|
});
|
|
410
420
|
}
|
|
@@ -487,11 +497,12 @@ var testStateToStatusValueMap = {
|
|
|
487
497
|
sidebarContextMenu: !1
|
|
488
498
|
}));
|
|
489
499
|
this.componentTestStatusStore.set(componentTestStatuses);
|
|
490
|
-
let a11yReportsByStoryId = {}, a11yStatuses = [];
|
|
500
|
+
let a11yReportsByStoryId = {}, reportsByStoryId = {}, a11yStatuses = [];
|
|
491
501
|
for (let { storyId, reports } of testCaseResultsToFlush) {
|
|
502
|
+
reports?.length && (reportsByStoryId[storyId] = reports);
|
|
492
503
|
let storyA11yReports = reports?.filter((r) => r.type === "a11y");
|
|
493
504
|
if (storyA11yReports?.length) {
|
|
494
|
-
a11yReportsByStoryId[storyId] = storyA11yReports.map((
|
|
505
|
+
a11yReportsByStoryId[storyId] = storyA11yReports.map((report) => report.result);
|
|
495
506
|
for (let a11yReport of storyA11yReports)
|
|
496
507
|
a11yStatuses.push({
|
|
497
508
|
storyId,
|
|
@@ -516,13 +527,25 @@ var testStateToStatusValueMap = {
|
|
|
516
527
|
currentRun: {
|
|
517
528
|
...s.currentRun,
|
|
518
529
|
componentTestCount: { success: ctSuccess, error: ctError },
|
|
519
|
-
a11yCount: {
|
|
530
|
+
a11yCount: {
|
|
531
|
+
success: a11ySuccess,
|
|
532
|
+
warning: a11yWarning,
|
|
533
|
+
error: a11yError
|
|
534
|
+
},
|
|
520
535
|
componentTestStatuses: s.currentRun.componentTestStatuses.concat(componentTestStatuses),
|
|
521
536
|
a11yStatuses: s.currentRun.a11yStatuses.concat(a11yStatuses),
|
|
537
|
+
/*
|
|
538
|
+
TODO: a11yReports is just here for backwards compatibility with older versions of addon-mcp.
|
|
539
|
+
They are also part of the more generic reports property, so we can remove this in a future major release when we can break compatibility.
|
|
540
|
+
*/
|
|
522
541
|
a11yReports: {
|
|
523
542
|
...s.currentRun.a11yReports,
|
|
524
543
|
...a11yReportsByStoryId
|
|
525
544
|
},
|
|
545
|
+
reports: {
|
|
546
|
+
...s.currentRun.reports,
|
|
547
|
+
...reportsByStoryId
|
|
548
|
+
},
|
|
526
549
|
// in some cases successes and errors can exceed the anticipated totalTestCount
|
|
527
550
|
// e.g. when testing more tests than the stories we know about upfront
|
|
528
551
|
// in those cases, we set the totalTestCount to the sum of successes and errors
|
|
@@ -531,7 +554,9 @@ var testStateToStatusValueMap = {
|
|
|
531
554
|
};
|
|
532
555
|
});
|
|
533
556
|
}, 500);
|
|
534
|
-
this.store = options.store, this.componentTestStatusStore = options.componentTestStatusStore, this.a11yStatusStore = options.a11yStatusStore, this.testProviderStore = options.testProviderStore, this.onReady = options.onReady, this.storybookOptions = options.storybookOptions, this.vitestManager = new VitestManager(this), this.store.subscribe("TRIGGER_RUN", this.handleTriggerRunEvent.bind(this)), this.store.subscribe("CANCEL_RUN", this.handleCancelEvent.bind(this)), this.store.untilReady().then(() => this.vitestManager.startVitest({
|
|
557
|
+
this.store = options.store, this.componentTestStatusStore = options.componentTestStatusStore, this.a11yStatusStore = options.a11yStatusStore, this.testProviderStore = options.testProviderStore, this.onReady = options.onReady, this.storybookOptions = options.storybookOptions, this.vitestManager = new VitestManager(this), this.store.subscribe("TRIGGER_RUN", this.handleTriggerRunEvent.bind(this)), this.store.subscribe("CANCEL_RUN", this.handleCancelEvent.bind(this)), this.store.untilReady().then(() => this.vitestManager.startVitest({
|
|
558
|
+
coverage: this.store.getState().config.coverage
|
|
559
|
+
})).then(() => this.onReady?.()).catch((e) => {
|
|
535
560
|
this.reportFatalError("Failed to start Vitest", e);
|
|
536
561
|
});
|
|
537
562
|
}
|
|
@@ -581,7 +606,7 @@ var testStateToStatusValueMap = {
|
|
|
581
606
|
storyIds,
|
|
582
607
|
config: runConfig
|
|
583
608
|
}
|
|
584
|
-
})),
|
|
609
|
+
})), await this.testProviderStore.runWithState(async () => {
|
|
585
610
|
if (await callback(), this.store.send({
|
|
586
611
|
type: "TEST_RUN_COMPLETED",
|
|
587
612
|
payload: this.store.getState().currentRun
|
package/dist/postinstall.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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
|
any
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
15
|
-
import {
|
|
16
|
-
DOCUMENTATION_LINK
|
|
17
|
-
} from "./_node-chunks/chunk-LOJFC6WB.js";
|
|
14
|
+
} from "./_node-chunks/chunk-JW5BT6WZ.js";
|
|
18
15
|
import {
|
|
19
16
|
require_dist
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-WYWXUN7N.js";
|
|
21
18
|
import {
|
|
22
19
|
dirname,
|
|
23
20
|
normalize,
|
|
24
21
|
relative,
|
|
25
22
|
resolve
|
|
26
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-U7LRX24F.js";
|
|
24
|
+
import {
|
|
25
|
+
DOCUMENTATION_LINK
|
|
26
|
+
} from "./_node-chunks/chunk-A547SDFI.js";
|
|
27
27
|
import {
|
|
28
28
|
require_compare,
|
|
29
29
|
require_constants,
|
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
require_parse_options,
|
|
34
34
|
require_re,
|
|
35
35
|
require_semver
|
|
36
|
-
} from "./_node-chunks/chunk-
|
|
36
|
+
} from "./_node-chunks/chunk-GYHEIW4A.js";
|
|
37
37
|
import {
|
|
38
38
|
__commonJS,
|
|
39
39
|
__toESM
|
|
40
|
-
} from "./_node-chunks/chunk-
|
|
40
|
+
} from "./_node-chunks/chunk-4L2EC3M2.js";
|
|
41
41
|
|
|
42
42
|
// ../../../node_modules/semver/functions/parse.js
|
|
43
43
|
var require_parse = __commonJS({
|
|
@@ -902,13 +902,13 @@ import {
|
|
|
902
902
|
async function getTemplatePath(name) {
|
|
903
903
|
switch (name) {
|
|
904
904
|
case "vitest.config.template":
|
|
905
|
-
return import("./_node-chunks/vitest.config.template-
|
|
905
|
+
return import("./_node-chunks/vitest.config.template-D5MYWETW.js");
|
|
906
906
|
case "vitest.config.4.template":
|
|
907
|
-
return import("./_node-chunks/vitest.config.4.template-
|
|
907
|
+
return import("./_node-chunks/vitest.config.4.template-TX4N3NT4.js");
|
|
908
908
|
case "vitest.config.3.2.template":
|
|
909
|
-
return import("./_node-chunks/vitest.config.3.2.template-
|
|
909
|
+
return import("./_node-chunks/vitest.config.3.2.template-EIQAXJPU.js");
|
|
910
910
|
case "vitest.workspace.template":
|
|
911
|
-
return import("./_node-chunks/vitest.workspace.template-
|
|
911
|
+
return import("./_node-chunks/vitest.workspace.template-GFBFW5FF.js");
|
|
912
912
|
default:
|
|
913
913
|
throw new Error(`Unknown template: ${name}`);
|
|
914
914
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,7 +13,16 @@ import {
|
|
|
13
13
|
errorToErrorLike,
|
|
14
14
|
log,
|
|
15
15
|
noop
|
|
16
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-VOW3K2GU.js";
|
|
17
|
+
import {
|
|
18
|
+
require_picocolors
|
|
19
|
+
} from "./_node-chunks/chunk-MJGFRMWT.js";
|
|
20
|
+
import {
|
|
21
|
+
require_dist
|
|
22
|
+
} from "./_node-chunks/chunk-WYWXUN7N.js";
|
|
23
|
+
import {
|
|
24
|
+
normalize
|
|
25
|
+
} from "./_node-chunks/chunk-U7LRX24F.js";
|
|
17
26
|
import {
|
|
18
27
|
ADDON_ID2 as ADDON_ID,
|
|
19
28
|
COVERAGE_DIRECTORY,
|
|
@@ -24,19 +33,10 @@ import {
|
|
|
24
33
|
TRIGGER_TEST_RUN_REQUEST,
|
|
25
34
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
26
35
|
storeOptions
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
28
|
-
import {
|
|
29
|
-
require_picocolors
|
|
30
|
-
} from "./_node-chunks/chunk-M346CYJL.js";
|
|
31
|
-
import {
|
|
32
|
-
require_dist
|
|
33
|
-
} from "./_node-chunks/chunk-YG4TBQOB.js";
|
|
34
|
-
import {
|
|
35
|
-
normalize
|
|
36
|
-
} from "./_node-chunks/chunk-PXU54O6X.js";
|
|
36
|
+
} from "./_node-chunks/chunk-A547SDFI.js";
|
|
37
37
|
import {
|
|
38
38
|
__toESM
|
|
39
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-4L2EC3M2.js";
|
|
40
40
|
|
|
41
41
|
// src/preset.ts
|
|
42
42
|
import { mkdir } from "node:fs/promises";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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-4L2EC3M2.js";
|
|
17
17
|
|
|
18
18
|
// ../../../node_modules/tree-kill/index.js
|
|
19
19
|
var require_tree_kill = __commonJS({
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_qjt8b575sgn from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_qjt8b575sgn from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_qjt8b575sgn from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_qjt8b575sgn.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_qjt8b575sgn.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_qjt8b575sgn.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-MJGFRMWT.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-WYWXUN7N.js";
|
|
18
18
|
import {
|
|
19
19
|
dirname,
|
|
20
20
|
join,
|
|
@@ -23,12 +23,16 @@ import {
|
|
|
23
23
|
relative,
|
|
24
24
|
resolve,
|
|
25
25
|
sep
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
26
|
+
} from "../_node-chunks/chunk-U7LRX24F.js";
|
|
27
|
+
import {
|
|
28
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
29
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY
|
|
30
|
+
} from "../_node-chunks/chunk-A547SDFI.js";
|
|
27
31
|
import {
|
|
28
32
|
__commonJS,
|
|
29
33
|
__require,
|
|
30
34
|
__toESM
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
35
|
+
} from "../_node-chunks/chunk-4L2EC3M2.js";
|
|
32
36
|
|
|
33
37
|
// ../../../node_modules/braces/lib/utils.js
|
|
34
38
|
var require_utils = __commonJS({
|
|
@@ -2341,8 +2345,14 @@ import {
|
|
|
2341
2345
|
} from "storybook/internal/core-server";
|
|
2342
2346
|
import { componentTransform, readConfig, vitestTransform } from "storybook/internal/csf-tools";
|
|
2343
2347
|
import { MainFileMissingError } from "storybook/internal/server-errors";
|
|
2344
|
-
import {
|
|
2345
|
-
|
|
2348
|
+
import {
|
|
2349
|
+
detectAgent,
|
|
2350
|
+
isTelemetryModuleEnabled,
|
|
2351
|
+
isWithinInitialSession,
|
|
2352
|
+
oneWayHash,
|
|
2353
|
+
telemetry as telemetry2,
|
|
2354
|
+
setTelemetryEnabled
|
|
2355
|
+
} from "storybook/internal/telemetry";
|
|
2346
2356
|
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1), import_ts_dedent2 = __toESM(require_dist(), 1);
|
|
2347
2357
|
|
|
2348
2358
|
// ../../builders/builder-vite/src/utils/without-vite-plugins.ts
|
|
@@ -2373,6 +2383,49 @@ async function requiresProjectAnnotations(testConfig, finalOptions) {
|
|
|
2373
2383
|
`), !1) : !0;
|
|
2374
2384
|
}
|
|
2375
2385
|
|
|
2386
|
+
// src/vitest-plugin/agent-telemetry-reporter.ts
|
|
2387
|
+
import { analyzeTestResults, toStoryTestResult } from "storybook/internal/core-server";
|
|
2388
|
+
import { isExampleStoryId, telemetry } from "storybook/internal/telemetry";
|
|
2389
|
+
var AgentTelemetryReporter = class {
|
|
2390
|
+
constructor(options) {
|
|
2391
|
+
this.testResults = [];
|
|
2392
|
+
this.startTime = Date.now();
|
|
2393
|
+
this.configDir = options.configDir, this.agent = options.agent;
|
|
2394
|
+
}
|
|
2395
|
+
onInit(ctx) {
|
|
2396
|
+
this.ctx = ctx;
|
|
2397
|
+
}
|
|
2398
|
+
onTestRunStart() {
|
|
2399
|
+
this.startTime = Date.now();
|
|
2400
|
+
}
|
|
2401
|
+
onTestCaseResult(testCase) {
|
|
2402
|
+
let { storyId, reports } = testCase.meta();
|
|
2403
|
+
if (!storyId || isExampleStoryId(storyId))
|
|
2404
|
+
return;
|
|
2405
|
+
let testResult = testCase.result(), result = toStoryTestResult({
|
|
2406
|
+
storyId,
|
|
2407
|
+
statusRaw: testResult.state,
|
|
2408
|
+
reports,
|
|
2409
|
+
errors: testResult.errors
|
|
2410
|
+
});
|
|
2411
|
+
result && this.testResults.push(result);
|
|
2412
|
+
}
|
|
2413
|
+
async onTestRunEnd(testModules, unhandledErrors) {
|
|
2414
|
+
let analysis = analyzeTestResults(this.testResults), duration = Date.now() - this.startTime, testModulesErrors = testModules.flatMap((t) => t.errors()), unhandledErrorCount = unhandledErrors.length + testModulesErrors.length;
|
|
2415
|
+
telemetry(
|
|
2416
|
+
"ai-setup-self-healing-scoring",
|
|
2417
|
+
{
|
|
2418
|
+
agent: this.agent,
|
|
2419
|
+
analysis,
|
|
2420
|
+
unhandledErrorCount,
|
|
2421
|
+
duration,
|
|
2422
|
+
watch: this.ctx.config.watch
|
|
2423
|
+
},
|
|
2424
|
+
{ configDir: this.configDir, stripMetadata: !0 }
|
|
2425
|
+
), this.testResults = [];
|
|
2426
|
+
}
|
|
2427
|
+
};
|
|
2428
|
+
|
|
2376
2429
|
// src/vitest-plugin/index.ts
|
|
2377
2430
|
var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
2378
2431
|
storybookScript: void 0,
|
|
@@ -2485,7 +2538,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2485
2538
|
...await withoutVitePlugins(viteConfigFromStorybook.plugins ?? [], pluginsToIgnore)
|
|
2486
2539
|
];
|
|
2487
2540
|
finalOptions.disableAddonDocs && plugins.push(mdxStubPlugin);
|
|
2488
|
-
let storybookTestPlugin = {
|
|
2541
|
+
let withinAgenticSetupSession = !1, storybookTestPlugin = {
|
|
2489
2542
|
name: "vite-plugin-storybook-test",
|
|
2490
2543
|
async transformIndexHtml(html) {
|
|
2491
2544
|
let [headHtmlSnippet, bodyHtmlSnippet] = await Promise.all([
|
|
@@ -2550,6 +2603,10 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2550
2603
|
__VITEST_EXCLUDE_TAGS__: finalOptions.tags.exclude.join(","),
|
|
2551
2604
|
__VITEST_SKIP_TAGS__: finalOptions.tags.skip.join(",")
|
|
2552
2605
|
},
|
|
2606
|
+
provide: {
|
|
2607
|
+
[STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY]: !!process.env.STORYBOOK_COMPONENT_PATHS,
|
|
2608
|
+
[STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY]: !!process.env.STORYBOOK_COMPONENT_PATHS
|
|
2609
|
+
},
|
|
2553
2610
|
include: [...includeStories, ...getComponentTestPaths()],
|
|
2554
2611
|
exclude: [
|
|
2555
2612
|
...nonMutableInputConfig.test?.exclude ?? [],
|
|
@@ -2565,16 +2622,6 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2565
2622
|
}
|
|
2566
2623
|
} : {},
|
|
2567
2624
|
browser: {
|
|
2568
|
-
commands: {
|
|
2569
|
-
getInitialGlobals: () => {
|
|
2570
|
-
let envConfig = JSON.parse(process.env.VITEST_STORYBOOK_CONFIG ?? "{}"), shouldRunA11yTests = isVitestStorybook ? envConfig.a11y ?? !1 : !0, globals = {};
|
|
2571
|
-
return globals.a11y = {
|
|
2572
|
-
manual: !shouldRunA11yTests
|
|
2573
|
-
}, process.env.STORYBOOK_COMPONENT_PATHS && (globals.ghostStories = {
|
|
2574
|
-
enabled: !0
|
|
2575
|
-
}), globals;
|
|
2576
|
-
}
|
|
2577
|
-
},
|
|
2578
2625
|
// if there is a test.browser config AND test.browser.screenshotFailures is not explicitly set, we set it to false
|
|
2579
2626
|
...nonMutableInputConfig.test?.browser && nonMutableInputConfig.test.browser.screenshotFailures === void 0 ? {
|
|
2580
2627
|
screenshotFailures: !1
|
|
@@ -2605,8 +2652,8 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2605
2652
|
`)
|
|
2606
2653
|
)), config;
|
|
2607
2654
|
},
|
|
2608
|
-
configureVitest(context) {
|
|
2609
|
-
context.vitest.config.coverage.exclude.push("storybook-static"),
|
|
2655
|
+
async configureVitest(context) {
|
|
2656
|
+
if (context.vitest.config.coverage.exclude.push("storybook-static"), telemetry2(
|
|
2610
2657
|
"test-run",
|
|
2611
2658
|
{
|
|
2612
2659
|
runner: "vitest",
|
|
@@ -2614,7 +2661,15 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2614
2661
|
coverage: !!context.vitest.config.coverage?.enabled
|
|
2615
2662
|
},
|
|
2616
2663
|
{ configDir: finalOptions.configDir }
|
|
2617
|
-
)
|
|
2664
|
+
), isTelemetryModuleEnabled()) {
|
|
2665
|
+
let agent = detectAgent();
|
|
2666
|
+
withinAgenticSetupSession = !!agent && await isWithinInitialSession("ai-setup"), withinAgenticSetupSession && await context.vitest.provide(STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY, !0), agent && withinAgenticSetupSession && context.vitest.config.reporters.push(
|
|
2667
|
+
new AgentTelemetryReporter({
|
|
2668
|
+
configDir: finalOptions.configDir,
|
|
2669
|
+
agent
|
|
2670
|
+
})
|
|
2671
|
+
);
|
|
2672
|
+
}
|
|
2618
2673
|
},
|
|
2619
2674
|
async configureServer(server) {
|
|
2620
2675
|
if (staticDirs)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
3
|
+
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
4
|
+
STORYBOOK_TEST_PROVIDE_KEY
|
|
5
|
+
} from "../_browser-chunks/chunk-OHAJYSSA.js";
|
|
6
|
+
|
|
1
7
|
// src/vitest-plugin/test-utils.ts
|
|
8
|
+
import { inject } from "vitest";
|
|
2
9
|
import { getStoryChildren, isStory } from "storybook/internal/csf";
|
|
3
|
-
import { server } from "@vitest/browser/context";
|
|
4
10
|
import { composeStory, getCsfFactoryAnnotations } from "storybook/preview-api";
|
|
5
11
|
|
|
6
12
|
// src/vitest-plugin/viewports.ts
|
|
@@ -50,7 +56,7 @@ var DEFAULT_VIEWPORT_DIMENSIONS = {
|
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
// src/vitest-plugin/test-utils.ts
|
|
53
|
-
var
|
|
59
|
+
var convertToFilePath = (url) => url.replace(/^file:\/\//, "").replace(/^\/+([a-zA-Z]:)/, "$1").replace(/%20/g, " "), testStory = ({
|
|
54
60
|
exportName,
|
|
55
61
|
story,
|
|
56
62
|
meta,
|
|
@@ -60,10 +66,40 @@ var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.re
|
|
|
60
66
|
testName,
|
|
61
67
|
componentName
|
|
62
68
|
}) => async (context) => {
|
|
63
|
-
let annotations = getCsfFactoryAnnotations(story, meta), test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0, storyAnnotations = test ? test.input : annotations.story,
|
|
69
|
+
let annotations = getCsfFactoryAnnotations(story, meta), test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0, storyAnnotations = test ? test.input : annotations.story, runConfig = { a11y: !0 };
|
|
70
|
+
try {
|
|
71
|
+
runConfig = inject(STORYBOOK_TEST_PROVIDE_KEY) ?? { a11y: !0 };
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
let ghostStoriesEnabled = !1;
|
|
75
|
+
try {
|
|
76
|
+
ghostStoriesEnabled = inject(STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY) ?? !1;
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
let renderAnalysisEnabled = !1;
|
|
80
|
+
try {
|
|
81
|
+
renderAnalysisEnabled = inject(STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY) ?? !1;
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
let shouldRunA11yTests = !!runConfig.a11y, initialGlobals = {
|
|
85
|
+
[STORYBOOK_TEST_PROVIDE_KEY]: runConfig,
|
|
86
|
+
...ghostStoriesEnabled ? {
|
|
87
|
+
ghostStories: {
|
|
88
|
+
enabled: !0
|
|
89
|
+
}
|
|
90
|
+
} : {},
|
|
91
|
+
...renderAnalysisEnabled ? {
|
|
92
|
+
renderAnalysis: {
|
|
93
|
+
enabled: !0
|
|
94
|
+
}
|
|
95
|
+
} : {},
|
|
96
|
+
a11y: {
|
|
97
|
+
manual: !shouldRunA11yTests
|
|
98
|
+
}
|
|
99
|
+
}, composedStory = composeStory(
|
|
64
100
|
storyAnnotations,
|
|
65
101
|
annotations.meta,
|
|
66
|
-
{ initialGlobals
|
|
102
|
+
{ initialGlobals },
|
|
67
103
|
annotations.preview ?? globalThis.globalProjectAnnotations,
|
|
68
104
|
exportName
|
|
69
105
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "10.4.0-alpha.
|
|
3
|
+
"version": "10.4.0-alpha.13",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@storybook/icons": "^2.0.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@storybook/addon-a11y": "10.4.0-alpha.
|
|
83
|
+
"@storybook/addon-a11y": "10.4.0-alpha.13",
|
|
84
84
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
85
85
|
"@types/micromatch": "^4.0.0",
|
|
86
86
|
"@types/node": "^22.19.1",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@vitest/browser": "^3.0.0 || ^4.0.0",
|
|
109
109
|
"@vitest/browser-playwright": "^4.0.0",
|
|
110
110
|
"@vitest/runner": "^3.0.0 || ^4.0.0",
|
|
111
|
-
"storybook": "^10.4.0-alpha.
|
|
111
|
+
"storybook": "^10.4.0-alpha.13",
|
|
112
112
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
113
113
|
},
|
|
114
114
|
"peerDependenciesMeta": {
|