@storybook/addon-vitest 0.0.0-pr-32799-sha-08b5d618 → 0.0.0-pr-32939-sha-3f0b505a
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-PMYV6BH2.js → chunk-CAYLRBRX.js} +1 -0
- package/dist/_node-chunks/{chunk-ATPI5GDU.js → chunk-2VXQI47B.js} +6 -6
- package/dist/_node-chunks/{chunk-CTLRZTSU.js → chunk-6FB3AIJX.js} +9 -9
- package/dist/_node-chunks/{chunk-STKSLUKS.js → chunk-EBUX7LWY.js} +8 -8
- package/dist/_node-chunks/{chunk-FIAZBKNW.js → chunk-L3UU4GCD.js} +7 -7
- package/dist/_node-chunks/{chunk-LPUBS4D4.js → chunk-LH6GKEW6.js} +7 -7
- package/dist/_node-chunks/{chunk-R5P46LQG.js → chunk-OTIJ62GC.js} +7 -6
- package/dist/_node-chunks/{chunk-ACQT7A26.js → chunk-QODVORKU.js} +7 -7
- package/dist/_node-chunks/{chunk-7HGCZTGE.js → chunk-ZYYVDUI2.js} +7 -7
- package/dist/manager.js +1 -1
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +18 -15
- package/dist/postinstall.js +92 -74
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +10 -9
- package/dist/vitest-plugin/setup-file.js +1 -1
- package/package.json +12 -8
- package/templates/vitest.config.3.2.template.ts +6 -1
- package/templates/vitest.config.4.template.ts +37 -0
- package/templates/vitest.config.template.ts +6 -1
- package/templates/vitest.workspace.template.ts +6 -1
|
@@ -7,6 +7,7 @@ var DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-th
|
|
|
7
7
|
// ../a11y/src/constants.ts
|
|
8
8
|
var ADDON_ID2 = "storybook/a11y";
|
|
9
9
|
var PANEL_ID2 = `${ADDON_ID2}/panel`;
|
|
10
|
+
var UI_STATE_ID = `${ADDON_ID2}/ui`;
|
|
10
11
|
var RESULT = `${ADDON_ID2}/result`;
|
|
11
12
|
var REQUEST = `${ADDON_ID2}/request`;
|
|
12
13
|
var RUNNING = `${ADDON_ID2}/running`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
ADDON_ID
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OTIJ62GC.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-L3UU4GCD.js";
|
|
18
18
|
import {
|
|
19
19
|
__name,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2VXQI47B.js";
|
|
22
22
|
|
|
23
23
|
// src/logger.ts
|
|
24
24
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,13 +12,13 @@ var require = CJS_COMPAT_NODE_MODULE_4yjjr1fpmb8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LH6GKEW6.js";
|
|
16
16
|
import {
|
|
17
17
|
__commonJS,
|
|
18
18
|
__name,
|
|
19
19
|
__require,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2VXQI47B.js";
|
|
22
22
|
|
|
23
23
|
// ../../node_modules/isexe/windows.js
|
|
24
24
|
var require_windows = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.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_4yjjr1fpmb8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2VXQI47B.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/picocolors/picocolors.js
|
|
18
18
|
var require_picocolors = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__name
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2VXQI47B.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
17
17
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -19,6 +19,7 @@ var DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#what-happens-when-th
|
|
|
19
19
|
// ../a11y/src/constants.ts
|
|
20
20
|
var ADDON_ID2 = "storybook/a11y";
|
|
21
21
|
var PANEL_ID2 = `${ADDON_ID2}/panel`;
|
|
22
|
+
var UI_STATE_ID = `${ADDON_ID2}/ui`;
|
|
22
23
|
var RESULT = `${ADDON_ID2}/result`;
|
|
23
24
|
var REQUEST = `${ADDON_ID2}/request`;
|
|
24
25
|
var RUNNING = `${ADDON_ID2}/running`;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__name
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2VXQI47B.js";
|
|
15
15
|
|
|
16
16
|
// src/utils.ts
|
|
17
17
|
function getAddonNames(mainConfig) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.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_4yjjr1fpmb8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2VXQI47B.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/semver/internal/constants.js
|
|
18
18
|
var require_constants = __commonJS({
|
package/dist/manager.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.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-ZYYVDUI2.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__name,
|
|
18
18
|
__require,
|
|
19
19
|
__toESM
|
|
20
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-2VXQI47B.js";
|
|
21
21
|
|
|
22
22
|
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
23
23
|
var require_make_dir = __commonJS({
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.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-6FB3AIJX.js";
|
|
15
15
|
import {
|
|
16
16
|
any,
|
|
17
17
|
errorToErrorLike
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
18
|
+
} from "../_node-chunks/chunk-QODVORKU.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID,
|
|
21
21
|
COVERAGE_DIRECTORY,
|
|
22
22
|
STATUS_TYPE_ID_A11Y,
|
|
23
23
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
24
24
|
storeOptions
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
26
|
-
import "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-OTIJ62GC.js";
|
|
26
|
+
import "../_node-chunks/chunk-L3UU4GCD.js";
|
|
27
27
|
import {
|
|
28
28
|
dirname,
|
|
29
29
|
join,
|
|
30
30
|
normalize,
|
|
31
31
|
path
|
|
32
|
-
} from "../_node-chunks/chunk-
|
|
32
|
+
} from "../_node-chunks/chunk-LH6GKEW6.js";
|
|
33
33
|
import {
|
|
34
34
|
__name
|
|
35
|
-
} from "../_node-chunks/chunk-
|
|
35
|
+
} from "../_node-chunks/chunk-2VXQI47B.js";
|
|
36
36
|
|
|
37
37
|
// src/node/vitest.ts
|
|
38
38
|
import process2 from "node:process";
|
|
@@ -234,7 +234,7 @@ var StorybookReporter = class {
|
|
|
234
234
|
this.ctx.state.pathsSet.clear();
|
|
235
235
|
this.ctx.state.idMap.clear();
|
|
236
236
|
this.ctx.state.errorsSet.clear();
|
|
237
|
-
this.ctx.state.processTimeoutCauses
|
|
237
|
+
this.ctx.state.processTimeoutCauses?.clear();
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
|
|
@@ -350,12 +350,15 @@ Please install the @vitest/${coveragePackage} package to collect coverage
|
|
|
350
350
|
this.vitest?.setGlobalTestNamePattern("");
|
|
351
351
|
}
|
|
352
352
|
updateLastChanged(filepath) {
|
|
353
|
-
|
|
354
|
-
projects.forEach(({ server, browser }) => {
|
|
353
|
+
this.vitest.projects.forEach(({ browser, vite, server }) => {
|
|
355
354
|
if (server) {
|
|
356
355
|
const serverMods = server.moduleGraph.getModulesByFile(filepath);
|
|
357
356
|
serverMods?.forEach((mod) => server.moduleGraph.invalidateModule(mod));
|
|
358
357
|
}
|
|
358
|
+
if (vite) {
|
|
359
|
+
const serverMods = vite.moduleGraph.getModulesByFile(filepath);
|
|
360
|
+
serverMods?.forEach((mod) => vite.moduleGraph.invalidateModule(mod));
|
|
361
|
+
}
|
|
359
362
|
if (browser) {
|
|
360
363
|
const browserMods = browser.vite.moduleGraph.getModulesByFile(filepath);
|
|
361
364
|
browserMods?.forEach((mod) => browser.vite.moduleGraph.invalidateModule(mod));
|
package/dist/postinstall.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,22 +12,22 @@ var require = CJS_COMPAT_NODE_MODULE_4yjjr1fpmb8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
execa,
|
|
14
14
|
resolvePackageDir
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-EBUX7LWY.js";
|
|
16
16
|
import {
|
|
17
17
|
any,
|
|
18
18
|
getAddonNames,
|
|
19
19
|
up
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-QODVORKU.js";
|
|
21
21
|
import {
|
|
22
22
|
DOCUMENTATION_LINK,
|
|
23
23
|
SUPPORTED_FRAMEWORKS
|
|
24
|
-
} from "./_node-chunks/chunk-
|
|
24
|
+
} from "./_node-chunks/chunk-OTIJ62GC.js";
|
|
25
25
|
import {
|
|
26
26
|
dirname,
|
|
27
27
|
join,
|
|
28
28
|
relative,
|
|
29
29
|
resolve
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-LH6GKEW6.js";
|
|
31
31
|
import {
|
|
32
32
|
require_compare,
|
|
33
33
|
require_constants,
|
|
@@ -37,12 +37,12 @@ import {
|
|
|
37
37
|
require_parse_options,
|
|
38
38
|
require_re,
|
|
39
39
|
require_semver
|
|
40
|
-
} from "./_node-chunks/chunk-
|
|
40
|
+
} from "./_node-chunks/chunk-ZYYVDUI2.js";
|
|
41
41
|
import {
|
|
42
42
|
__commonJS,
|
|
43
43
|
__name,
|
|
44
44
|
__toESM
|
|
45
|
-
} from "./_node-chunks/chunk-
|
|
45
|
+
} from "./_node-chunks/chunk-2VXQI47B.js";
|
|
46
46
|
|
|
47
47
|
// ../../node_modules/semver/functions/parse.js
|
|
48
48
|
var require_parse = __commonJS({
|
|
@@ -1616,10 +1616,7 @@ var updateConfigFile = /* @__PURE__ */ __name((source, target) => {
|
|
|
1616
1616
|
} else if (targetExportDefault.declaration.type === "CallExpression" && targetExportDefault.declaration.callee.type === "Identifier" && targetExportDefault.declaration.callee.name === "defineConfig" && targetExportDefault.declaration.arguments[0]?.type === "ObjectExpression") {
|
|
1617
1617
|
canHandleConfig = true;
|
|
1618
1618
|
} else if (targetExportDefault.declaration.type === "CallExpression" && targetExportDefault.declaration.callee.type === "Identifier" && targetExportDefault.declaration.callee.name === "mergeConfig" && targetExportDefault.declaration.arguments.length >= 2) {
|
|
1619
|
-
|
|
1620
|
-
(arg) => arg?.type === "CallExpression" && arg.callee.type === "Identifier" && arg.callee.name === "defineConfig" && arg.arguments[0]?.type === "ObjectExpression"
|
|
1621
|
-
);
|
|
1622
|
-
canHandleConfig = defineConfigNodes.length > 0;
|
|
1619
|
+
canHandleConfig = true;
|
|
1623
1620
|
}
|
|
1624
1621
|
if (!canHandleConfig) {
|
|
1625
1622
|
return false;
|
|
@@ -1652,20 +1649,24 @@ var updateConfigFile = /* @__PURE__ */ __name((source, target) => {
|
|
|
1652
1649
|
mergeProperties(properties, exportDefault.declaration.arguments[0].properties);
|
|
1653
1650
|
updated = true;
|
|
1654
1651
|
} else if (exportDefault.declaration.type === "CallExpression" && exportDefault.declaration.callee.type === "Identifier" && exportDefault.declaration.callee.name === "mergeConfig" && exportDefault.declaration.arguments.length >= 2) {
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1652
|
+
const configObjectNodes = [];
|
|
1653
|
+
for (const arg of exportDefault.declaration.arguments) {
|
|
1654
|
+
if (arg?.type === "CallExpression" && arg.callee.type === "Identifier" && arg.callee.name === "defineConfig" && arg.arguments[0]?.type === "ObjectExpression") {
|
|
1655
|
+
configObjectNodes.push(arg.arguments[0]);
|
|
1656
|
+
} else if (arg?.type === "ObjectExpression") {
|
|
1657
|
+
configObjectNodes.push(arg);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
const configObjectWithTest = configObjectNodes.find(
|
|
1661
|
+
(obj) => obj.properties.some(
|
|
1660
1662
|
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test"
|
|
1661
1663
|
)
|
|
1662
1664
|
);
|
|
1663
|
-
const
|
|
1664
|
-
if (!
|
|
1665
|
+
const targetConfigObject = configObjectWithTest || configObjectNodes[0];
|
|
1666
|
+
if (!targetConfigObject) {
|
|
1665
1667
|
return false;
|
|
1666
1668
|
}
|
|
1667
|
-
const
|
|
1668
|
-
const existingTestProp = defineConfigProps.properties.find(
|
|
1669
|
+
const existingTestProp = targetConfigObject.properties.find(
|
|
1669
1670
|
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test"
|
|
1670
1671
|
);
|
|
1671
1672
|
if (existingTestProp && existingTestProp.value.type === "ObjectExpression") {
|
|
@@ -1677,6 +1678,16 @@ var updateConfigFile = /* @__PURE__ */ __name((source, target) => {
|
|
|
1677
1678
|
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && (p.key.name === "workspace" || p.key.name === "projects")
|
|
1678
1679
|
);
|
|
1679
1680
|
if (workspaceOrProjectsProp && workspaceOrProjectsProp.value.type === "ArrayExpression") {
|
|
1681
|
+
const coverageProp = existingTestProp.value.properties.find(
|
|
1682
|
+
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "coverage"
|
|
1683
|
+
);
|
|
1684
|
+
const testPropsWithoutCoverage = existingTestProp.value.properties.filter(
|
|
1685
|
+
(p) => p !== coverageProp
|
|
1686
|
+
);
|
|
1687
|
+
const testConfigForProject = {
|
|
1688
|
+
type: "ObjectExpression",
|
|
1689
|
+
properties: testPropsWithoutCoverage
|
|
1690
|
+
};
|
|
1680
1691
|
const existingTestProject = {
|
|
1681
1692
|
type: "ObjectExpression",
|
|
1682
1693
|
properties: [
|
|
@@ -1690,25 +1701,28 @@ var updateConfigFile = /* @__PURE__ */ __name((source, target) => {
|
|
|
1690
1701
|
{
|
|
1691
1702
|
type: "ObjectProperty",
|
|
1692
1703
|
key: { type: "Identifier", name: "test" },
|
|
1693
|
-
value:
|
|
1704
|
+
value: testConfigForProject,
|
|
1694
1705
|
computed: false,
|
|
1695
1706
|
shorthand: false
|
|
1696
1707
|
}
|
|
1697
1708
|
]
|
|
1698
1709
|
};
|
|
1699
1710
|
workspaceOrProjectsProp.value.elements.unshift(existingTestProject);
|
|
1700
|
-
|
|
1711
|
+
targetConfigObject.properties = targetConfigObject.properties.filter(
|
|
1701
1712
|
(p) => p !== existingTestProp
|
|
1702
1713
|
);
|
|
1703
|
-
|
|
1714
|
+
if (coverageProp && templateTestProp.value.type === "ObjectExpression") {
|
|
1715
|
+
templateTestProp.value.properties.unshift(coverageProp);
|
|
1716
|
+
}
|
|
1717
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
1704
1718
|
} else {
|
|
1705
|
-
mergeProperties(properties,
|
|
1719
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
1706
1720
|
}
|
|
1707
1721
|
} else {
|
|
1708
|
-
mergeProperties(properties,
|
|
1722
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
1709
1723
|
}
|
|
1710
1724
|
} else {
|
|
1711
|
-
mergeProperties(properties,
|
|
1725
|
+
mergeProperties(properties, targetConfigObject.properties);
|
|
1712
1726
|
}
|
|
1713
1727
|
updated = true;
|
|
1714
1728
|
}
|
|
@@ -1791,12 +1805,18 @@ async function postInstall(options) {
|
|
|
1791
1805
|
const packageManager = JsPackageManagerFactory.getPackageManager({
|
|
1792
1806
|
force: options.packageManager
|
|
1793
1807
|
});
|
|
1794
|
-
const info2 = await getStorybookInfo(options);
|
|
1795
|
-
const allDeps = packageManager.getAllDependencies();
|
|
1796
|
-
const dependencies = ["vitest", "@vitest/browser", "playwright"].filter((p) => !allDeps[p]);
|
|
1797
1808
|
const vitestVersionSpecifier = await packageManager.getInstalledVersion("vitest");
|
|
1798
1809
|
const coercedVitestVersion = vitestVersionSpecifier ? (0, import_semver.coerce)(vitestVersionSpecifier) : null;
|
|
1799
|
-
const
|
|
1810
|
+
const isVitest3_2To4 = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=3.2.0 <4.0.0") : false;
|
|
1811
|
+
const isVitest4OrNewer = vitestVersionSpecifier ? (0, import_semver.satisfies)(vitestVersionSpecifier, ">=4.0.0") : true;
|
|
1812
|
+
const info2 = await getStorybookInfo(options);
|
|
1813
|
+
const allDeps = packageManager.getAllDependencies();
|
|
1814
|
+
const dependencies = [
|
|
1815
|
+
"vitest",
|
|
1816
|
+
"playwright",
|
|
1817
|
+
isVitest4OrNewer ? "@vitest/browser-playwright" : "@vitest/browser"
|
|
1818
|
+
];
|
|
1819
|
+
const uniqueDependencies = dependencies.filter((p) => !allDeps[p]);
|
|
1800
1820
|
const mainJsPath = getInterpretedFile(resolve(options.configDir, "main"));
|
|
1801
1821
|
const config = await readConfig(mainJsPath);
|
|
1802
1822
|
const hasCustomWebpackConfig = !!config.getFieldNode(["webpackFinal"]);
|
|
@@ -1930,7 +1950,7 @@ async function postInstall(options) {
|
|
|
1930
1950
|
);
|
|
1931
1951
|
try {
|
|
1932
1952
|
const storybookVersion = await packageManager.getInstalledVersion("storybook");
|
|
1933
|
-
|
|
1953
|
+
uniqueDependencies.push(`@storybook/nextjs-vite@^${storybookVersion}`);
|
|
1934
1954
|
} catch (e) {
|
|
1935
1955
|
console.error("Failed to install @storybook/nextjs-vite. Please install it manually");
|
|
1936
1956
|
}
|
|
@@ -1947,9 +1967,9 @@ async function postInstall(options) {
|
|
|
1947
1967
|
Read more about Vitest coverage providers at https://vitest.dev/guide/coverage.html#coverage-providers
|
|
1948
1968
|
`
|
|
1949
1969
|
);
|
|
1950
|
-
|
|
1970
|
+
uniqueDependencies.push(`@vitest/coverage-v8`);
|
|
1951
1971
|
}
|
|
1952
|
-
const versionedDependencies =
|
|
1972
|
+
const versionedDependencies = uniqueDependencies.map((p) => {
|
|
1953
1973
|
if (p.includes("vitest")) {
|
|
1954
1974
|
return vitestVersionSpecifier ? `${p}@${vitestVersionSpecifier}` : p;
|
|
1955
1975
|
}
|
|
@@ -2019,28 +2039,29 @@ async function postInstall(options) {
|
|
|
2019
2039
|
setProjectAnnotations([${projectAnnotations.join(", ")}]);
|
|
2020
2040
|
`
|
|
2021
2041
|
);
|
|
2022
|
-
const vitestWorkspaceFile = findFile("vitest.workspace", [".ts", ".js", ".json"])
|
|
2042
|
+
const vitestWorkspaceFile = findFile("vitest.workspace", [".ts", ".js", ".json"]);
|
|
2023
2043
|
const viteConfigFile = findFile("vite.config");
|
|
2024
2044
|
const vitestConfigFile = findFile("vitest.config");
|
|
2025
2045
|
const vitestShimFile = findFile("vitest.shims.d");
|
|
2026
2046
|
const rootConfig = vitestConfigFile || viteConfigFile;
|
|
2027
|
-
const browserConfig = `{
|
|
2028
|
-
enabled: true,
|
|
2029
|
-
headless: true,
|
|
2030
|
-
provider: 'playwright',
|
|
2031
|
-
instances: [{ browser: 'chromium' }]
|
|
2032
|
-
}`;
|
|
2033
2047
|
if (fileExtension === "ts" && !vitestShimFile) {
|
|
2034
2048
|
await writeFile(
|
|
2035
2049
|
"vitest.shims.d.ts",
|
|
2036
|
-
'/// <reference types="@vitest/browser/providers/playwright" />'
|
|
2050
|
+
isVitest4OrNewer ? '/// <reference types="@vitest/browser-playwright" />' : '/// <reference types="@vitest/browser/providers/playwright" />'
|
|
2037
2051
|
);
|
|
2038
2052
|
}
|
|
2053
|
+
const getTemplateName = /* @__PURE__ */ __name(() => {
|
|
2054
|
+
if (isVitest4OrNewer) {
|
|
2055
|
+
return "vitest.config.4.template.ts";
|
|
2056
|
+
} else if (isVitest3_2To4) {
|
|
2057
|
+
return "vitest.config.3.2.template.ts";
|
|
2058
|
+
}
|
|
2059
|
+
return "vitest.config.template.ts";
|
|
2060
|
+
}, "getTemplateName");
|
|
2039
2061
|
if (vitestWorkspaceFile) {
|
|
2040
2062
|
const workspaceTemplate = await loadTemplate("vitest.workspace.template.ts", {
|
|
2041
2063
|
EXTENDS_WORKSPACE: viteConfigFile ? relative(dirname(vitestWorkspaceFile), viteConfigFile) : "",
|
|
2042
2064
|
CONFIG_DIR: options.configDir,
|
|
2043
|
-
BROWSER_CONFIG: browserConfig,
|
|
2044
2065
|
SETUP_FILE: relative(dirname(vitestWorkspaceFile), vitestSetupFile)
|
|
2045
2066
|
}).then((t) => t.replace(`
|
|
2046
2067
|
'ROOT_CONFIG',`, "").replace(/\s+extends: '',/, ""));
|
|
@@ -2074,15 +2095,13 @@ async function postInstall(options) {
|
|
|
2074
2095
|
} else if (rootConfig) {
|
|
2075
2096
|
let target, updated;
|
|
2076
2097
|
const configFile = await fs2.readFile(rootConfig, "utf8");
|
|
2077
|
-
const hasProjectsConfig = configFile.includes("projects:");
|
|
2078
2098
|
const configFileHasTypeReference = configFile.match(
|
|
2079
2099
|
/\/\/\/\s*<reference\s+types=["']vitest\/config["']\s*\/>/
|
|
2080
2100
|
);
|
|
2081
|
-
const templateName =
|
|
2101
|
+
const templateName = getTemplateName();
|
|
2082
2102
|
if (templateName) {
|
|
2083
2103
|
const configTemplate = await loadTemplate(templateName, {
|
|
2084
2104
|
CONFIG_DIR: options.configDir,
|
|
2085
|
-
BROWSER_CONFIG: browserConfig,
|
|
2086
2105
|
SETUP_FILE: relative(dirname(rootConfig), vitestSetupFile)
|
|
2087
2106
|
});
|
|
2088
2107
|
const source = babelParse(configTemplate);
|
|
@@ -2094,9 +2113,10 @@ async function postInstall(options) {
|
|
|
2094
2113
|
logger2.plain(`${step} Updating your ${vitestConfigFile ? "Vitest" : "Vite"} config file:`);
|
|
2095
2114
|
logger2.plain(` ${rootConfig}`);
|
|
2096
2115
|
const formattedContent = await formatFileContent(rootConfig, generate(target).code);
|
|
2116
|
+
const shouldAddReference = !configFileHasTypeReference && !vitestConfigFile;
|
|
2097
2117
|
await writeFile(
|
|
2098
2118
|
rootConfig,
|
|
2099
|
-
|
|
2119
|
+
shouldAddReference ? '/// <reference types="vitest/config" />\n' + formattedContent : formattedContent
|
|
2100
2120
|
);
|
|
2101
2121
|
} else {
|
|
2102
2122
|
logErrors(
|
|
@@ -2111,14 +2131,10 @@ async function postInstall(options) {
|
|
|
2111
2131
|
}
|
|
2112
2132
|
} else {
|
|
2113
2133
|
const newConfigFile = resolve(`vitest.config.${fileExtension}`);
|
|
2114
|
-
const configTemplate = await loadTemplate(
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
BROWSER_CONFIG: browserConfig,
|
|
2119
|
-
SETUP_FILE: relative(dirname(newConfigFile), vitestSetupFile)
|
|
2120
|
-
}
|
|
2121
|
-
);
|
|
2134
|
+
const configTemplate = await loadTemplate(getTemplateName(), {
|
|
2135
|
+
CONFIG_DIR: options.configDir,
|
|
2136
|
+
SETUP_FILE: relative(dirname(newConfigFile), vitestSetupFile)
|
|
2137
|
+
});
|
|
2122
2138
|
logger2.line(1);
|
|
2123
2139
|
logger2.plain(`${step} Creating a Vitest config file:`);
|
|
2124
2140
|
logger2.plain(` ${newConfigFile}`);
|
|
@@ -2129,21 +2145,23 @@ async function postInstall(options) {
|
|
|
2129
2145
|
if (a11yAddon) {
|
|
2130
2146
|
try {
|
|
2131
2147
|
logger2.plain(`${step} Setting up ${addonA11yName} for @storybook/addon-vitest:`);
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2148
|
+
await execa(
|
|
2149
|
+
"storybook",
|
|
2150
|
+
[
|
|
2151
|
+
"automigrate",
|
|
2152
|
+
"addon-a11y-addon-test",
|
|
2153
|
+
"--loglevel",
|
|
2154
|
+
"silent",
|
|
2155
|
+
"--yes",
|
|
2156
|
+
"--skip-doctor",
|
|
2157
|
+
...options.packageManager ? ["--package-manager", options.packageManager] : [],
|
|
2158
|
+
...options.skipInstall ? ["--skip-install"] : [],
|
|
2159
|
+
...options.configDir !== ".storybook" ? ["--config-dir", `"${options.configDir}"`] : []
|
|
2160
|
+
],
|
|
2161
|
+
{
|
|
2162
|
+
stdio: "inherit"
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2147
2165
|
} catch (e) {
|
|
2148
2166
|
logErrors(
|
|
2149
2167
|
"\u{1F6A8} Oh no!",
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,11 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_4yjjr1fpmb8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-6FB3AIJX.js";
|
|
16
16
|
import {
|
|
17
17
|
execaNode,
|
|
18
18
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-EBUX7LWY.js";
|
|
20
20
|
import {
|
|
21
21
|
ADDON_ID,
|
|
22
22
|
COVERAGE_DIRECTORY,
|
|
@@ -25,17 +25,17 @@ import {
|
|
|
25
25
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
26
26
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
27
27
|
storeOptions
|
|
28
|
-
} from "./_node-chunks/chunk-
|
|
28
|
+
} from "./_node-chunks/chunk-OTIJ62GC.js";
|
|
29
29
|
import {
|
|
30
30
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
31
|
+
} from "./_node-chunks/chunk-L3UU4GCD.js";
|
|
32
32
|
import {
|
|
33
33
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
34
|
+
} from "./_node-chunks/chunk-LH6GKEW6.js";
|
|
35
35
|
import {
|
|
36
36
|
__name,
|
|
37
37
|
__toESM
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-2VXQI47B.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_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
__name,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-2VXQI47B.js";
|
|
18
18
|
|
|
19
19
|
// ../../node_modules/tree-kill/index.js
|
|
20
20
|
var require_tree_kill = __commonJS({
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_gak8rrbjnbb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_gak8rrbjnbb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_gak8rrbjnbb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_gak8rrbjnbb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_gak8rrbjnbb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_gak8rrbjnbb.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-L3UU4GCD.js";
|
|
15
15
|
import {
|
|
16
16
|
join,
|
|
17
17
|
normalize,
|
|
18
18
|
relative,
|
|
19
19
|
resolve,
|
|
20
20
|
sep
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-LH6GKEW6.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__name,
|
|
25
25
|
__require,
|
|
26
26
|
__toESM
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-2VXQI47B.js";
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/braces/lib/utils.js
|
|
30
30
|
var require_utils = __commonJS({
|
|
@@ -3683,6 +3683,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3683
3683
|
join(relative(finalOptions.vitestRoot, process.cwd()), "**/*.mdx").replaceAll(sep, "/")
|
|
3684
3684
|
],
|
|
3685
3685
|
// if the existing deps.inline is true, we keep it as-is, because it will inline everything
|
|
3686
|
+
// TODO: Remove the check once we don't support Vitest 3 anymore
|
|
3686
3687
|
...nonMutableInputConfig.test?.server?.deps?.inline !== true ? {
|
|
3687
3688
|
server: {
|
|
3688
3689
|
deps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-32939-sha-3f0b505a",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"@types/micromatch": "^4.0.0",
|
|
83
83
|
"@types/node": "^22.0.0",
|
|
84
84
|
"@types/semver": "^7",
|
|
85
|
-
"@vitest/browser": "^
|
|
86
|
-
"@vitest/runner": "^
|
|
85
|
+
"@vitest/browser-playwright": "^4.0.1",
|
|
86
|
+
"@vitest/runner": "^4.0.1",
|
|
87
87
|
"boxen": "^8.0.1",
|
|
88
88
|
"empathic": "^2.0.0",
|
|
89
89
|
"es-toolkit": "^1.36.0",
|
|
@@ -101,18 +101,22 @@
|
|
|
101
101
|
"tree-kill": "^1.2.2",
|
|
102
102
|
"ts-dedent": "^2.2.0",
|
|
103
103
|
"typescript": "^5.8.3",
|
|
104
|
-
"vitest": "^
|
|
104
|
+
"vitest": "^4.0.1"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@vitest/browser": "^3.0.0",
|
|
108
|
-
"@vitest/
|
|
109
|
-
"
|
|
110
|
-
"
|
|
107
|
+
"@vitest/browser": "^3.0.0 || ^4.0.0",
|
|
108
|
+
"@vitest/browser-playwright": "^4.0.0",
|
|
109
|
+
"@vitest/runner": "^3.0.0 || ^4.0.0",
|
|
110
|
+
"storybook": "^0.0.0-pr-32939-sha-3f0b505a",
|
|
111
|
+
"vitest": "^3.0.0 || ^4.0.0"
|
|
111
112
|
},
|
|
112
113
|
"peerDependenciesMeta": {
|
|
113
114
|
"@vitest/browser": {
|
|
114
115
|
"optional": true
|
|
115
116
|
},
|
|
117
|
+
"@vitest/browser-playwright": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
116
120
|
"@vitest/runner": {
|
|
117
121
|
"optional": true
|
|
118
122
|
},
|
|
@@ -21,7 +21,12 @@ export default defineConfig({
|
|
|
21
21
|
],
|
|
22
22
|
test: {
|
|
23
23
|
name: 'storybook',
|
|
24
|
-
browser:
|
|
24
|
+
browser: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
headless: true,
|
|
27
|
+
provider: 'playwright',
|
|
28
|
+
instances: [{ browser: 'chromium' }],
|
|
29
|
+
},
|
|
25
30
|
setupFiles: ['SETUP_FILE'],
|
|
26
31
|
},
|
|
27
32
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from 'vitest/config';
|
|
5
|
+
|
|
6
|
+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
7
|
+
|
|
8
|
+
import { playwright } from '@vitest/browser-playwright';
|
|
9
|
+
|
|
10
|
+
const dirname =
|
|
11
|
+
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
|
|
13
|
+
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
test: {
|
|
16
|
+
projects: [
|
|
17
|
+
{
|
|
18
|
+
extends: true,
|
|
19
|
+
plugins: [
|
|
20
|
+
// The plugin will run tests for the stories defined in your Storybook config
|
|
21
|
+
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
22
|
+
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
23
|
+
],
|
|
24
|
+
test: {
|
|
25
|
+
name: 'storybook',
|
|
26
|
+
browser: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
headless: true,
|
|
29
|
+
provider: playwright({}),
|
|
30
|
+
instances: [{ browser: 'chromium' }],
|
|
31
|
+
},
|
|
32
|
+
setupFiles: ['SETUP_FILE'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -21,7 +21,12 @@ export default defineConfig({
|
|
|
21
21
|
],
|
|
22
22
|
test: {
|
|
23
23
|
name: 'storybook',
|
|
24
|
-
browser:
|
|
24
|
+
browser: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
headless: true,
|
|
27
|
+
provider: 'playwright',
|
|
28
|
+
instances: [{ browser: 'chromium' }],
|
|
29
|
+
},
|
|
25
30
|
setupFiles: ['SETUP_FILE'],
|
|
26
31
|
},
|
|
27
32
|
},
|
|
@@ -20,7 +20,12 @@ export default defineWorkspace([
|
|
|
20
20
|
],
|
|
21
21
|
test: {
|
|
22
22
|
name: 'storybook',
|
|
23
|
-
browser:
|
|
23
|
+
browser: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
headless: true,
|
|
26
|
+
provider: 'playwright',
|
|
27
|
+
instances: [{ browser: 'chromium' }],
|
|
28
|
+
},
|
|
24
29
|
setupFiles: ['SETUP_FILE'],
|
|
25
30
|
},
|
|
26
31
|
},
|