@storybook/addon-vitest 10.3.0-beta.2 → 10.3.0
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-E34QA3CX.js → chunk-4XIKBWAW.js} +7 -7
- package/dist/_node-chunks/{chunk-YY3YIW6V.js → chunk-5WW2QKTR.js} +7 -7
- package/dist/_node-chunks/{chunk-HRU7VHV5.js → chunk-6OUSRF6P.js} +7 -7
- package/dist/_node-chunks/{chunk-7U6VKYWE.js → chunk-7O6ZMTPF.js} +6 -6
- package/dist/_node-chunks/{chunk-GGHR5QZN.js → chunk-ASPHSCXI.js} +6 -6
- package/dist/_node-chunks/{chunk-J4IW2AY3.js → chunk-CGWMPJ2W.js} +9 -9
- package/dist/_node-chunks/{chunk-72DNBL7U.js → chunk-OF5XRBAH.js} +6 -6
- package/dist/_node-chunks/{chunk-6GBFULEF.js → chunk-WVLDNREB.js} +6 -6
- package/dist/_node-chunks/{vitest.config-KBNZRFSF.js → vitest.config-CDVYGOWE.js} +7 -7
- package/dist/_node-chunks/{vitest.config.3.2-DGWNH4XT.js → vitest.config.3.2-BFKUVCBX.js} +7 -7
- package/dist/_node-chunks/{vitest.config.4-4SPUKNNZ.js → vitest.config.4-5YE425AK.js} +7 -7
- package/dist/_node-chunks/{vitest.workspace-ELOLB6YQ.js → vitest.workspace-OUE6DHK6.js} +7 -7
- package/dist/constants.js +8 -8
- package/dist/manager.js +2 -2
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +12 -12
- package/dist/postinstall.js +198 -126
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +10 -10
- package/package.json +6 -6
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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_ID2 as ADDON_ID
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OF5XRBAH.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5WW2QKTR.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7O6ZMTPF.js";
|
|
21
21
|
|
|
22
22
|
// src/logger.ts
|
|
23
23
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.template
|
|
15
15
|
var vitest_config_default = `import path from 'node:path';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.3.2.template
|
|
15
15
|
var vitest_config_3_2_default = `import path from 'node:path';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.4.template
|
|
15
15
|
var vitest_config_4_default = `import path from 'node:path';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.workspace.template
|
|
15
15
|
var vitest_workspace_default = `import path from 'node:path';
|
package/dist/constants.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
30
30
|
TUTORIAL_VIDEO_LINK,
|
|
31
31
|
storeOptions
|
|
32
|
-
} from "./_node-chunks/chunk-
|
|
33
|
-
import "./_node-chunks/chunk-
|
|
32
|
+
} from "./_node-chunks/chunk-OF5XRBAH.js";
|
|
33
|
+
import "./_node-chunks/chunk-7O6ZMTPF.js";
|
|
34
34
|
export {
|
|
35
35
|
ADDON_ID as A11Y_ADDON_ID,
|
|
36
36
|
PANEL_ID2 as A11Y_PANEL_ID,
|
package/dist/manager.js
CHANGED
|
@@ -363,10 +363,10 @@ function Description({
|
|
|
363
363
|
else if (testProviderState === "test-provider-state:running")
|
|
364
364
|
description = (finishedTestCount ?? 0) === 0 ? "Starting..." : `Testing... ${finishedTestCount}/${totalTestCount}`;
|
|
365
365
|
else if (!entryId && testProviderState === "test-provider-state:crashed")
|
|
366
|
-
description = setModalOpen ? React2.createElement(LinkComponent, {
|
|
366
|
+
description = setModalOpen ? React2.createElement(LinkComponent, { onClick: () => setModalOpen(!0) }, "View full error") : "Crashed";
|
|
367
367
|
else if (!entryId && unhandledErrors.length > 0) {
|
|
368
368
|
let unhandledErrorDescription = `View ${unhandledErrors.length} unhandled error${unhandledErrors?.length > 1 ? "s" : ""}`;
|
|
369
|
-
description = setModalOpen ? React2.createElement(LinkComponent, {
|
|
369
|
+
description = setModalOpen ? React2.createElement(LinkComponent, { onClick: () => setModalOpen(!0) }, unhandledErrorDescription) : unhandledErrorDescription;
|
|
370
370
|
} else entryId && totalTestCount ? description = `Ran ${totalTestCount} ${totalTestCount === 1 ? "test" : "tests"}` : finishedAt ? description = React2.createElement(React2.Fragment, null, "Ran ", totalTestCount, " ", totalTestCount === 1 ? "test" : "tests", " ", React2.createElement(RelativeTime, { timestamp: finishedAt })) : storeState.watching && (description = "Watching for file changes");
|
|
371
371
|
return React2.createElement(Wrapper, { ...props }, description);
|
|
372
372
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-4XIKBWAW.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-7O6ZMTPF.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,37 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-CGWMPJ2W.js";
|
|
15
15
|
import {
|
|
16
16
|
any,
|
|
17
17
|
up
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
18
|
+
} from "../_node-chunks/chunk-WVLDNREB.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID2 as 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-OF5XRBAH.js";
|
|
26
|
+
import "../_node-chunks/chunk-5WW2QKTR.js";
|
|
27
27
|
import {
|
|
28
28
|
dirname,
|
|
29
29
|
join,
|
|
30
30
|
normalize,
|
|
31
31
|
path,
|
|
32
32
|
resolve
|
|
33
|
-
} from "../_node-chunks/chunk-
|
|
34
|
-
import "../_node-chunks/chunk-
|
|
33
|
+
} from "../_node-chunks/chunk-ASPHSCXI.js";
|
|
34
|
+
import "../_node-chunks/chunk-7O6ZMTPF.js";
|
|
35
35
|
|
|
36
36
|
// src/node/vitest.ts
|
|
37
37
|
import process2 from "node:process";
|
package/dist/postinstall.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-
|
|
14
|
+
} from "./_node-chunks/chunk-WVLDNREB.js";
|
|
15
15
|
import {
|
|
16
16
|
DOCUMENTATION_LINK
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-OF5XRBAH.js";
|
|
18
18
|
import {
|
|
19
19
|
require_dist
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-6OUSRF6P.js";
|
|
21
21
|
import {
|
|
22
22
|
dirname,
|
|
23
23
|
normalize,
|
|
24
24
|
relative,
|
|
25
25
|
resolve
|
|
26
|
-
} from "./_node-chunks/chunk-
|
|
26
|
+
} from "./_node-chunks/chunk-ASPHSCXI.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-4XIKBWAW.js";
|
|
37
37
|
import {
|
|
38
38
|
__commonJS,
|
|
39
39
|
__toESM
|
|
40
|
-
} from "./_node-chunks/chunk-
|
|
40
|
+
} from "./_node-chunks/chunk-7O6ZMTPF.js";
|
|
41
41
|
|
|
42
42
|
// ../../../node_modules/semver/functions/parse.js
|
|
43
43
|
var require_parse = __commonJS({
|
|
@@ -892,16 +892,17 @@ import { SupportedFramework } from "storybook/internal/types";
|
|
|
892
892
|
var import_semver = __toESM(require_semver2(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
893
893
|
|
|
894
894
|
// src/updateVitestFile.ts
|
|
895
|
+
import { resolveExpression } from "storybook/internal/babel";
|
|
895
896
|
async function getTemplatePath(name) {
|
|
896
897
|
switch (name) {
|
|
897
898
|
case "vitest.config.template":
|
|
898
|
-
return import("./_node-chunks/vitest.config-
|
|
899
|
+
return import("./_node-chunks/vitest.config-CDVYGOWE.js");
|
|
899
900
|
case "vitest.config.4.template":
|
|
900
|
-
return import("./_node-chunks/vitest.config.4-
|
|
901
|
+
return import("./_node-chunks/vitest.config.4-5YE425AK.js");
|
|
901
902
|
case "vitest.config.3.2.template":
|
|
902
|
-
return import("./_node-chunks/vitest.config.3.2-
|
|
903
|
+
return import("./_node-chunks/vitest.config.3.2-BFKUVCBX.js");
|
|
903
904
|
case "vitest.workspace.template":
|
|
904
|
-
return import("./_node-chunks/vitest.workspace-
|
|
905
|
+
return import("./_node-chunks/vitest.workspace-OUE6DHK6.js");
|
|
905
906
|
default:
|
|
906
907
|
throw new Error(`Unknown template: ${name}`);
|
|
907
908
|
}
|
|
@@ -919,27 +920,145 @@ var loadTemplate = async (name, replacements) => {
|
|
|
919
920
|
);
|
|
920
921
|
targetProp && targetProp.type === "ObjectProperty" ? sourceProp.value.type === "ObjectExpression" && targetProp.value.type === "ObjectExpression" ? mergeProperties(sourceProp.value.properties, targetProp.value.properties) : sourceProp.value.type === "ArrayExpression" && targetProp.value.type === "ArrayExpression" ? targetProp.value.elements.push(...sourceProp.value.elements) : targetProp.value = sourceProp.value : target.push(sourceProp);
|
|
921
922
|
}
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
923
|
+
}, isImportedDefineConfigLikeIdentifier = (localName, ast) => ast.program.body.some(
|
|
924
|
+
(node) => node.type === "ImportDeclaration" && (node.source.value === "vitest/config" || node.source.value === "vite") && node.specifiers.some(
|
|
925
|
+
(specifier) => specifier.type === "ImportSpecifier" && specifier.local.type === "Identifier" && specifier.local.name === localName && specifier.imported.type === "Identifier" && (specifier.imported.name === "defineConfig" || specifier.imported.name === "defineProject")
|
|
926
|
+
)
|
|
927
|
+
), isDefineConfigLike = (node, ast) => node.callee.type === "Identifier" && (node.callee.name === "defineConfig" || node.callee.name === "defineProject" || isImportedDefineConfigLikeIdentifier(node.callee.name, ast)), getConfigObjectFromMergeArg = (arg, ast) => {
|
|
928
|
+
let resolved = resolveExpression(arg, ast);
|
|
929
|
+
return resolved ? resolved.type === "ObjectExpression" ? resolved : resolved.type === "CallExpression" && resolved.arguments[0]?.type === "ObjectExpression" ? resolved.arguments[0] : null : null;
|
|
930
|
+
}, resolveTestPropValue = (testProp, ast) => {
|
|
931
|
+
if (testProp.value.type === "ObjectExpression")
|
|
932
|
+
return testProp.value;
|
|
933
|
+
let resolved = resolveExpression(testProp.value, ast);
|
|
934
|
+
return resolved?.type === "ObjectExpression" ? resolved : null;
|
|
935
|
+
}, findNamedProp = (properties, name) => properties.find(
|
|
936
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === name
|
|
937
|
+
), isWorkspaceOrProjectsArrayProp = (p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && (p.key.name === "workspace" || p.key.name === "projects") && p.value.type === "ArrayExpression", appendToExistingProjectRefs = (existingProjectRefsProp, resolvedTestValue, templateTestProp, properties, targetConfigObject) => {
|
|
938
|
+
let existingKeyName = existingProjectRefsProp.key.type === "Identifier" ? existingProjectRefsProp.key.name : null;
|
|
939
|
+
if (templateTestProp && templateTestProp.value.type === "ObjectExpression") {
|
|
940
|
+
let templateProjectRefsProp = templateTestProp.value.properties.find(
|
|
941
|
+
(p) => isWorkspaceOrProjectsArrayProp(p) && (existingKeyName === null || p.key.type === "Identifier" && p.key.name === existingKeyName)
|
|
942
|
+
);
|
|
943
|
+
templateProjectRefsProp && templateProjectRefsProp.value.type === "ArrayExpression" && existingProjectRefsProp.value.elements.push(
|
|
944
|
+
...templateProjectRefsProp.value.elements
|
|
931
945
|
);
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
(
|
|
946
|
+
let existingTestPropNames = new Set(
|
|
947
|
+
resolvedTestValue.properties.filter(
|
|
948
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier"
|
|
949
|
+
).map((p) => p.key.name)
|
|
936
950
|
);
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
let init = declarator.init;
|
|
940
|
-
return init.type === "CallExpression" && init.callee.type === "Identifier" && init.callee.name === "defineConfig" && init.arguments[0]?.type === "ObjectExpression" ? init.arguments[0] : init.type === "ObjectExpression" ? init : null;
|
|
951
|
+
for (let templateProp of templateTestProp.value.properties)
|
|
952
|
+
templateProp.type === "ObjectProperty" && templateProp.key.type === "Identifier" && templateProp.key.name !== "projects" && templateProp.key.name !== "workspace" && !existingTestPropNames.has(templateProp.key.name) && resolvedTestValue.properties.push(templateProp);
|
|
941
953
|
}
|
|
942
|
-
|
|
954
|
+
let otherTemplateProps = properties.filter(
|
|
955
|
+
(p) => !(p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test")
|
|
956
|
+
);
|
|
957
|
+
otherTemplateProps.length > 0 && mergeProperties(otherTemplateProps, targetConfigObject.properties);
|
|
958
|
+
}, wrapTestConfigAsProject = (resolvedTestValue, existingTestProp, templateTestProp, properties, targetConfigObject) => {
|
|
959
|
+
let workspaceOrProjectsProp = templateTestProp.value.type === "ObjectExpression" ? templateTestProp.value.properties.find(
|
|
960
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && (p.key.name === "workspace" || p.key.name === "projects")
|
|
961
|
+
) : void 0;
|
|
962
|
+
if (!workspaceOrProjectsProp || workspaceOrProjectsProp.value.type !== "ArrayExpression") {
|
|
963
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
let topLevelProps = [
|
|
967
|
+
"shard",
|
|
968
|
+
"watch",
|
|
969
|
+
"run",
|
|
970
|
+
"cache",
|
|
971
|
+
"update",
|
|
972
|
+
"reporters",
|
|
973
|
+
"outputFile",
|
|
974
|
+
"teardownTimeout",
|
|
975
|
+
"silent",
|
|
976
|
+
"forceRerunTriggers",
|
|
977
|
+
"testNamePattern",
|
|
978
|
+
"ui",
|
|
979
|
+
"open",
|
|
980
|
+
"uiBase",
|
|
981
|
+
"snapshotFormat",
|
|
982
|
+
"resolveSnapshotPath",
|
|
983
|
+
"passWithNoTests",
|
|
984
|
+
"onConsoleLog",
|
|
985
|
+
"onStackTrace",
|
|
986
|
+
"dangerouslyIgnoreUnhandledErrors",
|
|
987
|
+
"slowTestThreshold",
|
|
988
|
+
"inspect",
|
|
989
|
+
"inspectBrk",
|
|
990
|
+
"coverage",
|
|
991
|
+
"watchTriggerPatterns"
|
|
992
|
+
].map(
|
|
993
|
+
(name) => findNamedProp(resolvedTestValue.properties, name)
|
|
994
|
+
).filter(Boolean), topLevelPropSet = new Set(topLevelProps), projectTestProps = resolvedTestValue.properties.filter(
|
|
995
|
+
(p) => !topLevelPropSet.has(p)
|
|
996
|
+
), existingTestProject = {
|
|
997
|
+
type: "ObjectExpression",
|
|
998
|
+
properties: [
|
|
999
|
+
{
|
|
1000
|
+
type: "ObjectProperty",
|
|
1001
|
+
key: { type: "Identifier", name: "extends" },
|
|
1002
|
+
value: { type: "BooleanLiteral", value: !0 },
|
|
1003
|
+
computed: !1,
|
|
1004
|
+
shorthand: !1
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
type: "ObjectProperty",
|
|
1008
|
+
key: { type: "Identifier", name: "test" },
|
|
1009
|
+
value: {
|
|
1010
|
+
type: "ObjectExpression",
|
|
1011
|
+
properties: projectTestProps
|
|
1012
|
+
},
|
|
1013
|
+
computed: !1,
|
|
1014
|
+
shorthand: !1
|
|
1015
|
+
}
|
|
1016
|
+
]
|
|
1017
|
+
};
|
|
1018
|
+
workspaceOrProjectsProp.value.elements.unshift(existingTestProject), targetConfigObject.properties = targetConfigObject.properties.filter(
|
|
1019
|
+
(p) => p !== existingTestProp
|
|
1020
|
+
), topLevelProps.length > 0 && templateTestProp.value.type === "ObjectExpression" && templateTestProp.value.properties.unshift(...topLevelProps), mergeProperties(properties, targetConfigObject.properties);
|
|
1021
|
+
}, mergeTemplateIntoConfigObject = (targetConfigObject, properties, target) => {
|
|
1022
|
+
let existingTestProp = findNamedProp(targetConfigObject.properties, "test"), resolvedTestValue = existingTestProp ? resolveTestPropValue(existingTestProp, target) : null, templateTestProp = findNamedProp(properties, "test");
|
|
1023
|
+
if (existingTestProp && resolvedTestValue !== null) {
|
|
1024
|
+
let existingProjectRefsProp = resolvedTestValue.properties.find(
|
|
1025
|
+
isWorkspaceOrProjectsArrayProp
|
|
1026
|
+
);
|
|
1027
|
+
if (existingProjectRefsProp) {
|
|
1028
|
+
appendToExistingProjectRefs(
|
|
1029
|
+
existingProjectRefsProp,
|
|
1030
|
+
resolvedTestValue,
|
|
1031
|
+
templateTestProp,
|
|
1032
|
+
properties,
|
|
1033
|
+
targetConfigObject
|
|
1034
|
+
);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (templateTestProp && templateTestProp.value.type === "ObjectExpression") {
|
|
1038
|
+
wrapTestConfigAsProject(
|
|
1039
|
+
resolvedTestValue,
|
|
1040
|
+
existingTestProp,
|
|
1041
|
+
templateTestProp,
|
|
1042
|
+
properties,
|
|
1043
|
+
targetConfigObject
|
|
1044
|
+
);
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
1049
|
+
}, getEffectiveMergeConfigCall = (decl, ast) => {
|
|
1050
|
+
let resolved = resolveExpression(decl, ast);
|
|
1051
|
+
if (!resolved || resolved.type !== "CallExpression")
|
|
1052
|
+
return null;
|
|
1053
|
+
if (isDefineConfigLike(resolved, ast) && resolved.arguments.length > 0) {
|
|
1054
|
+
let innerArg = resolveExpression(resolved.arguments[0], ast);
|
|
1055
|
+
if (innerArg?.type === "CallExpression" && innerArg.callee.type === "Identifier" && innerArg.callee.name === "mergeConfig")
|
|
1056
|
+
return innerArg;
|
|
1057
|
+
}
|
|
1058
|
+
return resolved.callee.type === "Identifier" && resolved.callee.name === "mergeConfig" ? resolved : null;
|
|
1059
|
+
}, getTargetConfigObject = (target, exportDefault) => {
|
|
1060
|
+
let resolved = resolveExpression(exportDefault.declaration, target);
|
|
1061
|
+
return resolved ? resolved.type === "ObjectExpression" ? resolved : resolved.type === "CallExpression" && isDefineConfigLike(resolved, target) && resolved.arguments[0]?.type === "ObjectExpression" ? resolved.arguments[0] : null : null;
|
|
943
1062
|
}, updateConfigFile = (source, target) => {
|
|
944
1063
|
let updated = !1, sourceExportDefault = source.program.body.find(
|
|
945
1064
|
(n) => n.type === "ExportDefaultDeclaration"
|
|
@@ -951,20 +1070,11 @@ var loadTemplate = async (name, replacements) => {
|
|
|
951
1070
|
);
|
|
952
1071
|
if (!targetExportDefault)
|
|
953
1072
|
return !1;
|
|
954
|
-
let
|
|
955
|
-
if (
|
|
1073
|
+
let effectiveDecl = resolveExpression(targetExportDefault.declaration, target);
|
|
1074
|
+
if (effectiveDecl?.type === "CallExpression" && isDefineConfigLike(effectiveDecl, target) && effectiveDecl.arguments.length > 0 && effectiveDecl.arguments[0].type === "ArrowFunctionExpression")
|
|
956
1075
|
return !1;
|
|
957
|
-
if (targetExportDefault.declaration.type === "Identifier") {
|
|
958
|
-
let varName = targetExportDefault.declaration.name, declarator = target.program.body.find(
|
|
959
|
-
(n) => n.type === "VariableDeclaration" && n.declarations.some((d) => d.id.type === "Identifier" && d.id.name === varName)
|
|
960
|
-
)?.declarations.find(
|
|
961
|
-
(d) => d.id.type === "Identifier" && d.id.name === varName
|
|
962
|
-
);
|
|
963
|
-
if (declarator?.init?.type === "CallExpression" && rejectFunctionNotation(declarator.init))
|
|
964
|
-
return !1;
|
|
965
|
-
}
|
|
966
1076
|
let canHandleConfig = !1;
|
|
967
|
-
if ((getTargetConfigObject(target, targetExportDefault) !== null || targetExportDefault.declaration
|
|
1077
|
+
if ((getTargetConfigObject(target, targetExportDefault) !== null || getEffectiveMergeConfigCall(targetExportDefault.declaration, target) !== null) && (canHandleConfig = !0), !canHandleConfig)
|
|
968
1078
|
return !1;
|
|
969
1079
|
for (let sourceNode of source.program.body)
|
|
970
1080
|
if (sourceNode.type === "ImportDeclaration") {
|
|
@@ -988,84 +1098,24 @@ var loadTemplate = async (name, replacements) => {
|
|
|
988
1098
|
if (exportDefault && sourceNode.declaration.type === "CallExpression" && sourceNode.declaration.arguments.length > 0 && sourceNode.declaration.arguments[0].type === "ObjectExpression") {
|
|
989
1099
|
let { properties } = sourceNode.declaration.arguments[0], targetConfigObject = getTargetConfigObject(target, exportDefault);
|
|
990
1100
|
if (targetConfigObject !== null)
|
|
991
|
-
|
|
992
|
-
else
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
), hasProjectsProp = (p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "projects" && p.value.type === "ArrayExpression", existingProjectsProp = existingTestProp.value.properties.find(hasProjectsProp);
|
|
1010
|
-
if (existingProjectsProp) {
|
|
1011
|
-
if (templateTestProp && templateTestProp.value.type === "ObjectExpression") {
|
|
1012
|
-
let templateProjectsProp = templateTestProp.value.properties.find(hasProjectsProp);
|
|
1013
|
-
if (templateProjectsProp && templateProjectsProp.value.type === "ArrayExpression") {
|
|
1014
|
-
let templateElements = templateProjectsProp.value.elements;
|
|
1015
|
-
existingProjectsProp.value.elements.push(
|
|
1016
|
-
...templateElements
|
|
1017
|
-
);
|
|
1018
|
-
}
|
|
1019
|
-
for (let templateProp of templateTestProp.value.properties)
|
|
1020
|
-
templateProp.type === "ObjectProperty" && templateProp.key.type === "Identifier" && templateProp.key.name !== "projects" && !existingTestProp.value.properties.find(
|
|
1021
|
-
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === templateProp.key.name
|
|
1022
|
-
) && templateProp.type === "ObjectProperty" && existingTestProp.value.properties.push(templateProp);
|
|
1023
|
-
}
|
|
1024
|
-
let otherTemplateProps = properties.filter(
|
|
1025
|
-
(p) => !(p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test")
|
|
1026
|
-
);
|
|
1027
|
-
otherTemplateProps.length > 0 && mergeProperties(otherTemplateProps, targetConfigObject2.properties);
|
|
1028
|
-
} else if (templateTestProp && templateTestProp.value.type === "ObjectExpression") {
|
|
1029
|
-
let workspaceOrProjectsProp = templateTestProp.value.properties.find(
|
|
1030
|
-
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && (p.key.name === "workspace" || p.key.name === "projects")
|
|
1031
|
-
);
|
|
1032
|
-
if (workspaceOrProjectsProp && workspaceOrProjectsProp.value.type === "ArrayExpression") {
|
|
1033
|
-
let coverageProp = existingTestProp.value.properties.find(
|
|
1034
|
-
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "coverage"
|
|
1035
|
-
), testConfigForProject = {
|
|
1036
|
-
type: "ObjectExpression",
|
|
1037
|
-
properties: existingTestProp.value.properties.filter(
|
|
1038
|
-
(p) => p !== coverageProp
|
|
1039
|
-
)
|
|
1040
|
-
}, existingTestProject = {
|
|
1041
|
-
type: "ObjectExpression",
|
|
1042
|
-
properties: [
|
|
1043
|
-
{
|
|
1044
|
-
type: "ObjectProperty",
|
|
1045
|
-
key: { type: "Identifier", name: "extends" },
|
|
1046
|
-
value: { type: "BooleanLiteral", value: !0 },
|
|
1047
|
-
computed: !1,
|
|
1048
|
-
shorthand: !1
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
type: "ObjectProperty",
|
|
1052
|
-
key: { type: "Identifier", name: "test" },
|
|
1053
|
-
value: testConfigForProject,
|
|
1054
|
-
computed: !1,
|
|
1055
|
-
shorthand: !1
|
|
1056
|
-
}
|
|
1057
|
-
]
|
|
1058
|
-
};
|
|
1059
|
-
workspaceOrProjectsProp.value.elements.unshift(existingTestProject), targetConfigObject2.properties = targetConfigObject2.properties.filter(
|
|
1060
|
-
(p) => p !== existingTestProp
|
|
1061
|
-
), coverageProp && templateTestProp.value.type === "ObjectExpression" && templateTestProp.value.properties.unshift(coverageProp), mergeProperties(properties, targetConfigObject2.properties);
|
|
1062
|
-
} else
|
|
1063
|
-
mergeProperties(properties, targetConfigObject2.properties);
|
|
1064
|
-
} else
|
|
1065
|
-
mergeProperties(properties, targetConfigObject2.properties);
|
|
1066
|
-
} else
|
|
1067
|
-
mergeProperties(properties, targetConfigObject2.properties);
|
|
1068
|
-
updated = !0;
|
|
1101
|
+
mergeTemplateIntoConfigObject(targetConfigObject, properties, target), updated = !0;
|
|
1102
|
+
else {
|
|
1103
|
+
let mergeConfigCall = getEffectiveMergeConfigCall(exportDefault.declaration, target);
|
|
1104
|
+
if (mergeConfigCall && mergeConfigCall.arguments.length >= 2) {
|
|
1105
|
+
let configObjectNodes = [];
|
|
1106
|
+
for (let arg of mergeConfigCall.arguments) {
|
|
1107
|
+
let configObject = getConfigObjectFromMergeArg(arg, target);
|
|
1108
|
+
configObject && configObjectNodes.push(configObject);
|
|
1109
|
+
}
|
|
1110
|
+
let targetConfigObject2 = configObjectNodes.find(
|
|
1111
|
+
(obj) => obj.properties.some(
|
|
1112
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test"
|
|
1113
|
+
)
|
|
1114
|
+
) || configObjectNodes[0];
|
|
1115
|
+
if (!targetConfigObject2)
|
|
1116
|
+
return !1;
|
|
1117
|
+
mergeTemplateIntoConfigObject(targetConfigObject2, properties, target), updated = !0;
|
|
1118
|
+
}
|
|
1069
1119
|
}
|
|
1070
1120
|
}
|
|
1071
1121
|
}
|
|
@@ -1169,7 +1219,7 @@ async function postInstall(options) {
|
|
|
1169
1219
|
"vitest.shims.d.ts",
|
|
1170
1220
|
isVitest4OrNewer ? '/// <reference types="@vitest/browser-playwright" />' : '/// <reference types="@vitest/browser/providers/playwright" />'
|
|
1171
1221
|
);
|
|
1172
|
-
let getTemplateName = () => isVitest4OrNewer ? "vitest.config.4.template" : isVitest3_2To4 ? "vitest.config.3.2.template" : "vitest.config.template";
|
|
1222
|
+
let getTemplateName = (configContent) => isVitest4OrNewer ? "vitest.config.4.template" : isVitest3_2To4 ? configContent && configUsesWorkspace(configContent) ? "vitest.config.template" : "vitest.config.3.2.template" : "vitest.config.template";
|
|
1173
1223
|
if (vitestWorkspaceFile) {
|
|
1174
1224
|
let workspaceFileContent = await fs.readFile(vitestWorkspaceFile, "utf8");
|
|
1175
1225
|
if (isConfigAlreadySetup(vitestWorkspaceFile, workspaceFileContent)) {
|
|
@@ -1205,7 +1255,7 @@ async function postInstall(options) {
|
|
|
1205
1255
|
} else if (rootConfig) {
|
|
1206
1256
|
let target, updated, configFile = await fs.readFile(rootConfig, "utf8"), configFileHasTypeReference = configFile.match(
|
|
1207
1257
|
/\/\/\/\s*<reference\s+types=["']vitest\/config["']\s*\/>/
|
|
1208
|
-
), templateName = getTemplateName(), alreadyConfigured = isConfigAlreadySetup(rootConfig, configFile);
|
|
1258
|
+
), templateName = getTemplateName(configFile), alreadyConfigured = isConfigAlreadySetup(rootConfig, configFile);
|
|
1209
1259
|
if (templateName && !alreadyConfigured) {
|
|
1210
1260
|
let configTemplate = await loadTemplate(templateName, {
|
|
1211
1261
|
CONFIG_DIR: options.configDir
|
|
@@ -1322,6 +1372,28 @@ function isConfigAlreadySetup(_configPath, configContent) {
|
|
|
1322
1372
|
}
|
|
1323
1373
|
}), pluginReferenced;
|
|
1324
1374
|
}
|
|
1375
|
+
function configUsesWorkspace(configContent) {
|
|
1376
|
+
let ast;
|
|
1377
|
+
try {
|
|
1378
|
+
ast = babelParse(configContent);
|
|
1379
|
+
} catch {
|
|
1380
|
+
return !1;
|
|
1381
|
+
}
|
|
1382
|
+
let found = !1;
|
|
1383
|
+
return traverse(ast, {
|
|
1384
|
+
ObjectProperty(path) {
|
|
1385
|
+
if (found) {
|
|
1386
|
+
path.stop();
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
let key = path.node.key;
|
|
1390
|
+
if (key.type === "Identifier" && key.name === "workspace") {
|
|
1391
|
+
let parent = path.parentPath?.parentPath;
|
|
1392
|
+
parent?.isObjectProperty() && parent.node.key.type === "Identifier" && parent.node.key.name === "test" && (found = !0, path.stop());
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}), found;
|
|
1396
|
+
}
|
|
1325
1397
|
export {
|
|
1326
1398
|
postInstall as default,
|
|
1327
1399
|
isConfigAlreadySetup
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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_ebvs8i04x8k.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-CGWMPJ2W.js";
|
|
16
16
|
import {
|
|
17
17
|
ADDON_ID2 as ADDON_ID,
|
|
18
18
|
COVERAGE_DIRECTORY,
|
|
@@ -23,19 +23,19 @@ import {
|
|
|
23
23
|
TRIGGER_TEST_RUN_REQUEST,
|
|
24
24
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
25
25
|
storeOptions
|
|
26
|
-
} from "./_node-chunks/chunk-
|
|
26
|
+
} from "./_node-chunks/chunk-OF5XRBAH.js";
|
|
27
27
|
import {
|
|
28
28
|
require_picocolors
|
|
29
|
-
} from "./_node-chunks/chunk-
|
|
29
|
+
} from "./_node-chunks/chunk-5WW2QKTR.js";
|
|
30
30
|
import {
|
|
31
31
|
require_dist
|
|
32
|
-
} from "./_node-chunks/chunk-
|
|
32
|
+
} from "./_node-chunks/chunk-6OUSRF6P.js";
|
|
33
33
|
import {
|
|
34
34
|
normalize
|
|
35
|
-
} from "./_node-chunks/chunk-
|
|
35
|
+
} from "./_node-chunks/chunk-ASPHSCXI.js";
|
|
36
36
|
import {
|
|
37
37
|
__toESM
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-7O6ZMTPF.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_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-7O6ZMTPF.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_limgmxzaufl from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_limgmxzaufl from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_limgmxzaufl from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_limgmxzaufl.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_limgmxzaufl.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_limgmxzaufl.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-5WW2QKTR.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-6OUSRF6P.js";
|
|
18
18
|
import {
|
|
19
19
|
dirname,
|
|
20
20
|
join,
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
relative,
|
|
24
24
|
resolve,
|
|
25
25
|
sep
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
26
|
+
} from "../_node-chunks/chunk-ASPHSCXI.js";
|
|
27
27
|
import {
|
|
28
28
|
__commonJS,
|
|
29
29
|
__require,
|
|
30
30
|
__toESM
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
31
|
+
} from "../_node-chunks/chunk-7O6ZMTPF.js";
|
|
32
32
|
|
|
33
33
|
// ../../../node_modules/braces/lib/utils.js
|
|
34
34
|
var require_utils = __commonJS({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "10.3.0
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"@storybook/icons": "^2.0.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@storybook/addon-a11y": "10.3.0
|
|
83
|
+
"@storybook/addon-a11y": "10.3.0",
|
|
84
84
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
85
85
|
"@types/micromatch": "^4.0.0",
|
|
86
86
|
"@types/node": "^22.19.1",
|
|
87
87
|
"@types/semver": "^7.7.1",
|
|
88
|
-
"@vitest/browser-playwright": "^4.0
|
|
89
|
-
"@vitest/runner": "^4.0
|
|
88
|
+
"@vitest/browser-playwright": "^4.1.0",
|
|
89
|
+
"@vitest/runner": "^4.1.0",
|
|
90
90
|
"empathic": "^2.0.0",
|
|
91
91
|
"es-toolkit": "^1.43.0",
|
|
92
92
|
"istanbul-lib-report": "^3.0.1",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"tree-kill": "^1.2.2",
|
|
103
103
|
"ts-dedent": "^2.2.0",
|
|
104
104
|
"typescript": "^5.9.3",
|
|
105
|
-
"vitest": "^4.0
|
|
105
|
+
"vitest": "^4.1.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
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.3.0
|
|
111
|
+
"storybook": "^10.3.0",
|
|
112
112
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
113
113
|
},
|
|
114
114
|
"peerDependenciesMeta": {
|