@storybook/addon-vitest 11.0.0-alpha.7 → 11.0.0-alpha.8
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-ZGV2ODKH.js → chunk-2KSL6GBQ.js} +6 -6
- package/dist/_node-chunks/{chunk-ZBTRLSUY.js → chunk-6NTJLCDE.js} +6 -6
- package/dist/_node-chunks/{chunk-6CLSAVWJ.js → chunk-BHE6WXVW.js} +9 -9
- package/dist/_node-chunks/{chunk-R32VM5JX.js → chunk-LRDGLC63.js} +6 -6
- package/dist/_node-chunks/{chunk-I4KLCFNQ.js → chunk-PYGCQ2XJ.js} +6 -6
- package/dist/_node-chunks/{chunk-AF2YLJ2G.js → chunk-UKLH76WC.js} +7 -7
- package/dist/_node-chunks/{chunk-P3WCWO47.js → chunk-ZGTRYRYR.js} +7 -7
- package/dist/_node-chunks/{chunk-UNH5GLWY.js → chunk-ZS2H7IJD.js} +7 -7
- package/dist/_node-chunks/{vitest.config.4.template-MHVHJLPK.js → vitest.config.4.template-CWGQLSCP.js} +8 -12
- package/dist/constants.js +8 -8
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +12 -12
- package/dist/postinstall.js +245 -294
- package/dist/preset.js +13 -13
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +13 -13
- package/package.json +4 -4
- package/templates/vitest.config.4.template.ts +1 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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 "./chunk-
|
|
14
|
+
} from "./chunk-UKLH76WC.js";
|
|
15
15
|
import {
|
|
16
16
|
ADDON_ID2 as ADDON_ID
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2KSL6GBQ.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-PYGCQ2XJ.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-PYGCQ2XJ.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-PYGCQ2XJ.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-PYGCQ2XJ.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-PYGCQ2XJ.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';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
16
|
|
|
18
17
|
import { defineConfig } from 'vitest/config';
|
|
19
18
|
|
|
@@ -21,9 +20,6 @@ import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
|
21
20
|
|
|
22
21
|
import { playwright } from '@vitest/browser-playwright';
|
|
23
22
|
|
|
24
|
-
const dirname =
|
|
25
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
-
|
|
27
23
|
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
28
24
|
export default defineConfig({
|
|
29
25
|
test: {
|
|
@@ -33,7 +29,7 @@ export default defineConfig({
|
|
|
33
29
|
plugins: [
|
|
34
30
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
35
31
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
36
|
-
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
32
|
+
storybookTest({ configDir: path.join(import.meta.dirname, 'CONFIG_DIR') }),
|
|
37
33
|
],
|
|
38
34
|
test: {
|
|
39
35
|
name: 'storybook',
|
package/dist/constants.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -35,8 +35,8 @@ import {
|
|
|
35
35
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
36
36
|
TUTORIAL_VIDEO_LINK,
|
|
37
37
|
storeOptions
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
39
|
-
import "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-2KSL6GBQ.js";
|
|
39
|
+
import "./_node-chunks/chunk-PYGCQ2XJ.js";
|
|
40
40
|
export {
|
|
41
41
|
ADDON_ID as A11Y_ADDON_ID,
|
|
42
42
|
PANEL_ID2 as A11Y_PANEL_ID,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-ZS2H7IJD.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-PYGCQ2XJ.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,19 +13,19 @@ import {
|
|
|
13
13
|
errorToErrorLike,
|
|
14
14
|
globalThis_,
|
|
15
15
|
log
|
|
16
|
-
} from "../_node-chunks/chunk-
|
|
16
|
+
} from "../_node-chunks/chunk-BHE6WXVW.js";
|
|
17
17
|
import {
|
|
18
18
|
any,
|
|
19
19
|
up
|
|
20
|
-
} from "../_node-chunks/chunk-
|
|
21
|
-
import "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-6NTJLCDE.js";
|
|
21
|
+
import "../_node-chunks/chunk-UKLH76WC.js";
|
|
22
22
|
import {
|
|
23
23
|
dirname,
|
|
24
24
|
join,
|
|
25
25
|
normalize,
|
|
26
26
|
path,
|
|
27
27
|
resolve
|
|
28
|
-
} from "../_node-chunks/chunk-
|
|
28
|
+
} from "../_node-chunks/chunk-LRDGLC63.js";
|
|
29
29
|
import {
|
|
30
30
|
ADDON_ID2 as ADDON_ID,
|
|
31
31
|
COVERAGE_DIRECTORY,
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
STORYBOOK_TEST_PROVIDE_KEY,
|
|
35
35
|
STORY_INDEX_CHANNEL_EVENT_NAME,
|
|
36
36
|
storeOptions
|
|
37
|
-
} from "../_node-chunks/chunk-
|
|
38
|
-
import "../_node-chunks/chunk-
|
|
37
|
+
} from "../_node-chunks/chunk-2KSL6GBQ.js";
|
|
38
|
+
import "../_node-chunks/chunk-PYGCQ2XJ.js";
|
|
39
39
|
|
|
40
40
|
// src/node/vitest.ts
|
|
41
41
|
import process2 from "node:process";
|
package/dist/postinstall.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-6NTJLCDE.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-ZGTRYRYR.js";
|
|
18
18
|
import {
|
|
19
19
|
dirname,
|
|
20
20
|
normalize,
|
|
21
21
|
relative,
|
|
22
22
|
resolve
|
|
23
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-LRDGLC63.js";
|
|
24
24
|
import {
|
|
25
25
|
DOCUMENTATION_LINK
|
|
26
|
-
} from "./_node-chunks/chunk-
|
|
26
|
+
} from "./_node-chunks/chunk-2KSL6GBQ.js";
|
|
27
27
|
import {
|
|
28
28
|
__toESM
|
|
29
|
-
} from "./_node-chunks/chunk-
|
|
29
|
+
} from "./_node-chunks/chunk-PYGCQ2XJ.js";
|
|
30
30
|
|
|
31
31
|
// src/postinstall.ts
|
|
32
32
|
import * as fs from "node:fs/promises";
|
|
33
33
|
import { writeFile } from "node:fs/promises";
|
|
34
34
|
import os from "node:os";
|
|
35
|
-
import { babelParse as babelParse2, generate as generate2, traverse as traverse2 } from "storybook/internal/babel";
|
|
36
35
|
import { AddonVitestService } from "storybook/internal/cli";
|
|
37
36
|
import {
|
|
38
37
|
JsPackageManagerFactory,
|
|
@@ -40,6 +39,12 @@ import {
|
|
|
40
39
|
getProjectRoot,
|
|
41
40
|
getStorybookInfo
|
|
42
41
|
} from "storybook/internal/common";
|
|
42
|
+
import {
|
|
43
|
+
SourceEditor as SourceEditor3,
|
|
44
|
+
parseModule,
|
|
45
|
+
restoreLineEndings,
|
|
46
|
+
walk as walk2
|
|
47
|
+
} from "storybook/internal/csf-tools";
|
|
43
48
|
import { CLI_COLORS } from "storybook/internal/node-logger";
|
|
44
49
|
import {
|
|
45
50
|
AddonVitestPostinstallConfigUpdateError,
|
|
@@ -51,302 +56,256 @@ var import_ts_dedent = __toESM(require_dist(), 1);
|
|
|
51
56
|
|
|
52
57
|
// src/angular-vitest-postinstall.ts
|
|
53
58
|
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
SourceEditor,
|
|
60
|
+
arrayList,
|
|
61
|
+
insertAfterImports,
|
|
62
|
+
prependToList,
|
|
63
|
+
printString,
|
|
64
|
+
walk
|
|
65
|
+
} from "storybook/internal/csf-tools";
|
|
59
66
|
var ANGULAR_VITEST_IMPORT_SOURCE = "@storybook/angular-vite/vitest", ANGULAR_VITEST_PLUGIN_CALL = "storybookAngularVitest", STORYBOOK_TEST_PLUGIN_SOURCE = "@storybook/addon-vitest/vitest-plugin", STORYBOOK_TEST_PLUGIN_CALL = "storybookTest";
|
|
60
67
|
function isAngularVitestAlreadyWired(content) {
|
|
61
68
|
return content.includes(ANGULAR_VITEST_IMPORT_SOURCE) || content.includes(`${ANGULAR_VITEST_PLUGIN_CALL}(`);
|
|
62
69
|
}
|
|
63
|
-
function collectStorybookTestLocalNames(
|
|
70
|
+
function collectStorybookTestLocalNames(program) {
|
|
64
71
|
let names = /* @__PURE__ */ new Set([STORYBOOK_TEST_PLUGIN_CALL]);
|
|
65
|
-
|
|
66
|
-
ImportDeclaration(
|
|
67
|
-
|
|
68
|
-
"local" in specifier && specifier.local?.name && names.add(specifier.local.name);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}), names;
|
|
72
|
-
}
|
|
73
|
-
function ensureImport(ast) {
|
|
74
|
-
let hasImport = !1;
|
|
75
|
-
if (traverse(ast, {
|
|
76
|
-
ImportDeclaration(path) {
|
|
77
|
-
if (path.node.source.value !== ANGULAR_VITEST_IMPORT_SOURCE)
|
|
78
|
-
return;
|
|
79
|
-
path.node.specifiers.some(
|
|
80
|
-
(specifier) => specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name === ANGULAR_VITEST_PLUGIN_CALL
|
|
81
|
-
) && (hasImport = !0, path.stop());
|
|
82
|
-
}
|
|
83
|
-
}), hasImport)
|
|
84
|
-
return;
|
|
85
|
-
let importDecl = t.importDeclaration(
|
|
86
|
-
[
|
|
87
|
-
t.importSpecifier(
|
|
88
|
-
t.identifier(ANGULAR_VITEST_PLUGIN_CALL),
|
|
89
|
-
t.identifier(ANGULAR_VITEST_PLUGIN_CALL)
|
|
90
|
-
)
|
|
91
|
-
],
|
|
92
|
-
t.stringLiteral(ANGULAR_VITEST_IMPORT_SOURCE)
|
|
93
|
-
), lastImportIndex = ast.program.body.findLastIndex((n) => n.type === "ImportDeclaration");
|
|
94
|
-
ast.program.body.splice(lastImportIndex + 1, 0, importDecl);
|
|
95
|
-
}
|
|
96
|
-
function buildAngularVitestCall() {
|
|
97
|
-
let call = t.callExpression(t.identifier(ANGULAR_VITEST_PLUGIN_CALL), [t.objectExpression([])]);
|
|
98
|
-
return t.addComment(
|
|
99
|
-
call,
|
|
100
|
-
"leading",
|
|
101
|
-
" Forwards Angular build options (styles, assets, zoneless, \u2026) into standalone vitest runs",
|
|
102
|
-
!0
|
|
103
|
-
), call;
|
|
104
|
-
}
|
|
105
|
-
function arrayHasAngularVitest(array) {
|
|
106
|
-
return array.elements.some(
|
|
107
|
-
(el) => el?.type === "CallExpression" && el.callee.type === "Identifier" && el.callee.name === ANGULAR_VITEST_PLUGIN_CALL
|
|
108
|
-
);
|
|
72
|
+
for (let node of program.body)
|
|
73
|
+
node.type === "ImportDeclaration" && node.source.value === STORYBOOK_TEST_PLUGIN_SOURCE && node.specifiers.forEach((specifier) => names.add(specifier.local.name));
|
|
74
|
+
return names;
|
|
109
75
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
76
|
+
var hasAngularVitestImport = (program) => program.body.some(
|
|
77
|
+
(node) => node.type === "ImportDeclaration" && node.source.value === ANGULAR_VITEST_IMPORT_SOURCE && node.specifiers.some(
|
|
78
|
+
(specifier) => specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name === ANGULAR_VITEST_PLUGIN_CALL
|
|
79
|
+
)
|
|
80
|
+
), isCallTo = (node, names) => node?.type === "CallExpression" && node.callee.type === "Identifier" && names.has(node.callee.name);
|
|
81
|
+
function injectAngularVitestIntoEditor(editor) {
|
|
82
|
+
let { program } = editor, localNames = collectStorybookTestLocalNames(program), pluginsArray;
|
|
83
|
+
if (walk(program, (node, parent) => {
|
|
84
|
+
if (pluginsArray)
|
|
85
|
+
return !1;
|
|
86
|
+
parent?.type === "ArrayExpression" && isCallTo(node, localNames) && (pluginsArray = parent);
|
|
121
87
|
}), !pluginsArray)
|
|
122
88
|
return !1;
|
|
123
|
-
let
|
|
124
|
-
|
|
89
|
+
let bridge = /* @__PURE__ */ new Set([ANGULAR_VITEST_PLUGIN_CALL]);
|
|
90
|
+
if (pluginsArray.elements.some((element) => isCallTo(element, bridge)) || prependToList(editor, arrayList(editor, pluginsArray), [
|
|
91
|
+
`// Forwards Angular build options (styles, assets, zoneless, \u2026) into standalone vitest runs
|
|
92
|
+
${ANGULAR_VITEST_PLUGIN_CALL}({})`
|
|
93
|
+
]), !hasAngularVitestImport(program)) {
|
|
94
|
+
let statement = `import { ${ANGULAR_VITEST_PLUGIN_CALL} } from ${printString(ANGULAR_VITEST_IMPORT_SOURCE, editor.quote)};`;
|
|
95
|
+
insertAfterImports(editor, statement);
|
|
96
|
+
}
|
|
97
|
+
return !0;
|
|
125
98
|
}
|
|
126
|
-
function injectAngularVitestIntoConfig(content) {
|
|
127
|
-
let
|
|
99
|
+
function injectAngularVitestIntoConfig(content, fileName) {
|
|
100
|
+
let editor;
|
|
128
101
|
try {
|
|
129
|
-
|
|
102
|
+
editor = new SourceEditor(content, fileName);
|
|
130
103
|
} catch {
|
|
131
104
|
return null;
|
|
132
105
|
}
|
|
133
|
-
return
|
|
106
|
+
return injectAngularVitestIntoEditor(editor) ? editor.toString() : null;
|
|
134
107
|
}
|
|
135
108
|
|
|
136
109
|
// src/updateVitestFile.ts
|
|
110
|
+
import { isBuiltin } from "node:module";
|
|
137
111
|
import {
|
|
112
|
+
findExportDefault,
|
|
138
113
|
getConfigObjectFromMergeArg,
|
|
139
114
|
getEffectiveMergeConfigCall,
|
|
140
115
|
getTargetConfigObject,
|
|
141
|
-
isDefineConfigLike,
|
|
142
116
|
resolveExpression
|
|
143
|
-
} from "storybook/internal/
|
|
117
|
+
} from "storybook/internal/cli";
|
|
118
|
+
import {
|
|
119
|
+
SourceEditor as SourceEditor2,
|
|
120
|
+
appendToList,
|
|
121
|
+
arrayList as arrayList2,
|
|
122
|
+
insertAfterImports as insertAfterImports2,
|
|
123
|
+
itemText,
|
|
124
|
+
lineIndent,
|
|
125
|
+
reindent,
|
|
126
|
+
objectList,
|
|
127
|
+
prependToList as prependToList2,
|
|
128
|
+
printMembers,
|
|
129
|
+
statementSpan,
|
|
130
|
+
staticKey
|
|
131
|
+
} from "storybook/internal/csf-tools";
|
|
144
132
|
async function getTemplatePath() {
|
|
145
|
-
return import("./_node-chunks/vitest.config.4.template-
|
|
133
|
+
return import("./_node-chunks/vitest.config.4.template-CWGQLSCP.js");
|
|
146
134
|
}
|
|
147
135
|
var loadTemplate = async (name, replacements) => {
|
|
148
136
|
let template = (await getTemplatePath()).default;
|
|
149
137
|
return Object.entries(replacements).forEach(
|
|
150
138
|
([key, value]) => template = template.replace(key, normalize(value))
|
|
151
139
|
), template;
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
140
|
+
}, findNamedProp = (members, name) => members.find(
|
|
141
|
+
(member) => member.type === "Property" && !member.method && member.kind === "init" && staticKey(member) === name
|
|
142
|
+
), isProjectsArrayProp = (member) => staticKey(member) === "projects" && member.value.type === "ArrayExpression", memberTexts = (editor, object, members) => members.map((member) => itemText(editor, objectList(editor, object), member)), elementTexts = (editor, array) => arrayList2(editor, array).items.map(
|
|
143
|
+
(element) => itemText(editor, arrayList2(editor, array), element)
|
|
144
|
+
), mergeProperties = ({ source, target }, from, into, fromMembers = from.properties) => {
|
|
145
|
+
let appended = [];
|
|
146
|
+
for (let sourceProp of fromMembers) {
|
|
147
|
+
let name = staticKey(sourceProp);
|
|
148
|
+
if (!name)
|
|
149
|
+
continue;
|
|
150
|
+
let targetProp = findNamedProp(into.properties, name);
|
|
151
|
+
if (!targetProp) {
|
|
152
|
+
appended.push(...memberTexts(source, from, [sourceProp]));
|
|
153
|
+
continue;
|
|
159
154
|
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
|
|
155
|
+
let { value: sourceValue } = sourceProp, { value: targetValue } = targetProp;
|
|
156
|
+
sourceValue.type === "ObjectExpression" && targetValue.type === "ObjectExpression" ? mergeProperties({ source, target }, sourceValue, targetValue) : sourceValue.type === "ArrayExpression" && targetValue.type === "ArrayExpression" ? appendToList(target, arrayList2(target, targetValue), elementTexts(source, sourceValue)) : targetProp.shorthand ? target.edits.overwrite(
|
|
157
|
+
targetProp.start,
|
|
158
|
+
targetProp.end,
|
|
159
|
+
`${name}: ${source.source(sourceValue)}`
|
|
160
|
+
) : target.edits.overwrite(targetValue.start, targetValue.end, source.source(sourceValue));
|
|
161
|
+
}
|
|
162
|
+
appended.length > 0 && appendToList(target, objectList(target, into), appended);
|
|
163
|
+
}, appendToExistingProjects = (merge, existingProjects, testObject, templateConfig, targetConfig) => {
|
|
164
|
+
let templateTest = findNamedProp(templateConfig.properties, "test");
|
|
165
|
+
if (templateTest?.value.type === "ObjectExpression") {
|
|
166
|
+
let templateTestObject = templateTest.value, templateProjects = templateTestObject.properties.find(isProjectsArrayProp);
|
|
167
|
+
templateProjects && appendToList(
|
|
168
|
+
merge.target,
|
|
169
|
+
arrayList2(merge.target, existingProjects),
|
|
170
|
+
elementTexts(merge.source, templateProjects.value)
|
|
174
171
|
);
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
let existingNames = new Set(testObject.properties.map(staticKey)), added = templateTestObject.properties.filter((member) => {
|
|
173
|
+
let name = staticKey(member);
|
|
174
|
+
return name !== void 0 && name !== "projects" && !existingNames.has(name);
|
|
175
|
+
});
|
|
176
|
+
added.length > 0 && appendToList(
|
|
177
|
+
merge.target,
|
|
178
|
+
objectList(merge.target, testObject),
|
|
179
|
+
memberTexts(merge.source, templateTestObject, added)
|
|
179
180
|
);
|
|
180
|
-
for (let templateProp of templateTestProp.value.properties)
|
|
181
|
-
templateProp.type === "ObjectProperty" && templateProp.key.type === "Identifier" && templateProp.key.name !== "projects" && !existingTestPropNames.has(templateProp.key.name) && resolvedTestValue.properties.push(templateProp);
|
|
182
181
|
}
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
mergeProperties(
|
|
183
|
+
merge,
|
|
184
|
+
templateConfig,
|
|
185
|
+
targetConfig,
|
|
186
|
+
templateConfig.properties.filter((member) => staticKey(member) !== "test")
|
|
185
187
|
);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
}, TOP_LEVEL_TEST_PROPERTIES = [
|
|
189
|
+
"shard",
|
|
190
|
+
"watch",
|
|
191
|
+
"run",
|
|
192
|
+
"cache",
|
|
193
|
+
"update",
|
|
194
|
+
"reporters",
|
|
195
|
+
"outputFile",
|
|
196
|
+
"teardownTimeout",
|
|
197
|
+
"silent",
|
|
198
|
+
"forceRerunTriggers",
|
|
199
|
+
"testNamePattern",
|
|
200
|
+
"ui",
|
|
201
|
+
"open",
|
|
202
|
+
"uiBase",
|
|
203
|
+
"snapshotFormat",
|
|
204
|
+
"resolveSnapshotPath",
|
|
205
|
+
"passWithNoTests",
|
|
206
|
+
"onConsoleLog",
|
|
207
|
+
"onStackTrace",
|
|
208
|
+
"dangerouslyIgnoreUnhandledErrors",
|
|
209
|
+
"slowTestThreshold",
|
|
210
|
+
"inspect",
|
|
211
|
+
"inspectBrk",
|
|
212
|
+
"coverage",
|
|
213
|
+
"watchTriggerPatterns"
|
|
214
|
+
], wrapTestConfigAsProject = (merge, existingTest, testObject, templateConfig, targetConfig) => {
|
|
215
|
+
let { source, target } = merge, templateTestObject = findNamedProp(templateConfig().properties, "test").value, templateProjects = templateTestObject.properties.find(isProjectsArrayProp);
|
|
216
|
+
if (!templateProjects) {
|
|
217
|
+
mergeProperties(merge, templateConfig(), targetConfig);
|
|
191
218
|
return;
|
|
192
219
|
}
|
|
193
|
-
let
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
value: { type: "BooleanLiteral", value: !0 },
|
|
230
|
-
computed: !1,
|
|
231
|
-
shorthand: !1
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
type: "ObjectProperty",
|
|
235
|
-
key: { type: "Identifier", name: "test" },
|
|
236
|
-
value: {
|
|
237
|
-
type: "ObjectExpression",
|
|
238
|
-
properties: projectTestProps
|
|
239
|
-
},
|
|
240
|
-
computed: !1,
|
|
241
|
-
shorthand: !1
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
};
|
|
245
|
-
projectsProp.value.elements.unshift(existingTestProject), targetConfigObject.properties = targetConfigObject.properties.filter(
|
|
246
|
-
(p) => p !== existingTestProp
|
|
247
|
-
), topLevelProps.length > 0 && templateTestProp.value.type === "ObjectExpression" && templateTestProp.value.properties.unshift(...topLevelProps), mergeProperties(properties, targetConfigObject.properties);
|
|
248
|
-
}, mergeTemplateIntoConfigObject = (targetConfigObject, properties, target) => {
|
|
249
|
-
let existingTestProp = findNamedProp(targetConfigObject.properties, "test"), resolvedTestValue = existingTestProp ? resolveTestPropValue(existingTestProp, target) : null, templateTestProp = findNamedProp(properties, "test");
|
|
250
|
-
if (existingTestProp && resolvedTestValue !== null) {
|
|
251
|
-
let existingProjectRefsProp = resolvedTestValue.properties.find(isProjectsArrayProp);
|
|
252
|
-
if (existingProjectRefsProp) {
|
|
253
|
-
appendToExistingProjectRefs(
|
|
254
|
-
existingProjectRefsProp,
|
|
255
|
-
resolvedTestValue,
|
|
256
|
-
templateTestProp,
|
|
257
|
-
properties,
|
|
258
|
-
targetConfigObject
|
|
220
|
+
let hoisted = TOP_LEVEL_TEST_PROPERTIES.map(
|
|
221
|
+
(name) => findNamedProp(testObject.properties, name)
|
|
222
|
+
).filter((member) => member !== void 0), projectMembers = testObject.properties.filter(
|
|
223
|
+
(member) => !hoisted.includes(member)
|
|
224
|
+
), projectTest = printMembers(memberTexts(target, testObject, projectMembers), source.indent), project = printMembers(["extends: true", `test: ${projectTest}`], source.indent);
|
|
225
|
+
prependToList2(source, arrayList2(source, templateProjects.value), [project]), hoisted.length > 0 && prependToList2(
|
|
226
|
+
source,
|
|
227
|
+
objectList(source, templateTestObject),
|
|
228
|
+
memberTexts(target, testObject, hoisted)
|
|
229
|
+
), source.commit();
|
|
230
|
+
let config = templateConfig(), templateTest = findNamedProp(config.properties, "test");
|
|
231
|
+
target.edits.overwrite(
|
|
232
|
+
existingTest.start,
|
|
233
|
+
existingTest.end,
|
|
234
|
+
reindent(
|
|
235
|
+
itemText(source, objectList(source, config), templateTest),
|
|
236
|
+
"",
|
|
237
|
+
lineIndent(target.code, existingTest.start)
|
|
238
|
+
)
|
|
239
|
+
), mergeProperties(
|
|
240
|
+
merge,
|
|
241
|
+
config,
|
|
242
|
+
targetConfig,
|
|
243
|
+
config.properties.filter((member) => member !== templateTest)
|
|
244
|
+
);
|
|
245
|
+
}, mergeTemplateIntoConfigObject = (merge, targetConfig, templateConfig) => {
|
|
246
|
+
let existingTest = findNamedProp(targetConfig.properties, "test"), testObject = existingTest ? resolveExpression(existingTest.value, merge.target.program) : null;
|
|
247
|
+
if (existingTest && testObject?.type === "ObjectExpression") {
|
|
248
|
+
let existingProjects = testObject.properties.find(isProjectsArrayProp);
|
|
249
|
+
if (existingProjects) {
|
|
250
|
+
appendToExistingProjects(
|
|
251
|
+
merge,
|
|
252
|
+
existingProjects.value,
|
|
253
|
+
testObject,
|
|
254
|
+
templateConfig(),
|
|
255
|
+
targetConfig
|
|
259
256
|
);
|
|
260
257
|
return;
|
|
261
258
|
}
|
|
262
|
-
if (
|
|
263
|
-
wrapTestConfigAsProject(
|
|
264
|
-
resolvedTestValue,
|
|
265
|
-
existingTestProp,
|
|
266
|
-
templateTestProp,
|
|
267
|
-
properties,
|
|
268
|
-
targetConfigObject
|
|
269
|
-
);
|
|
259
|
+
if (findNamedProp(templateConfig().properties, "test")?.value.type === "ObjectExpression") {
|
|
260
|
+
wrapTestConfigAsProject(merge, existingTest, testObject, templateConfig, targetConfig);
|
|
270
261
|
return;
|
|
271
262
|
}
|
|
272
263
|
}
|
|
273
|
-
mergeProperties(
|
|
274
|
-
},
|
|
275
|
-
let
|
|
276
|
-
if (
|
|
277
|
-
return
|
|
278
|
-
let
|
|
279
|
-
if (
|
|
280
|
-
return null;
|
|
281
|
-
let callbackArg = resolvedDecl.arguments[0];
|
|
282
|
-
if (!callbackArg || callbackArg.type !== "ArrowFunctionExpression" && callbackArg.type !== "FunctionExpression")
|
|
264
|
+
mergeProperties(merge, templateConfig(), targetConfig);
|
|
265
|
+
}, findWritableConfigObject = (program, exportDefault) => {
|
|
266
|
+
let configObject = getTargetConfigObject(program, exportDefault);
|
|
267
|
+
if (configObject)
|
|
268
|
+
return configObject;
|
|
269
|
+
let mergeConfigCall = getEffectiveMergeConfigCall(exportDefault.declaration, program);
|
|
270
|
+
if (!mergeConfigCall || mergeConfigCall.arguments.length < 2)
|
|
283
271
|
return null;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
let
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (!target.program.body.some(
|
|
309
|
-
(targetNode) => targetNode.type === sourceNode.type && targetNode.specifiers.some((s) => s.local.name === sourceNode.specifiers[0].local.name)
|
|
310
|
-
)) {
|
|
311
|
-
let lastImport = target.program.body.findLastIndex((n) => n.type === "ImportDeclaration");
|
|
312
|
-
target.program.body.splice(lastImport + 1, 0, sourceNode);
|
|
313
|
-
}
|
|
314
|
-
} else if (sourceNode.type === "VariableDeclaration") {
|
|
315
|
-
if (!target.program.body.some(
|
|
316
|
-
(targetNode) => targetNode.type === sourceNode.type && targetNode.declarations.some(
|
|
317
|
-
(d) => "name" in d.id && "name" in sourceNode.declarations[0].id && d.id.name === sourceNode.declarations[0].id.name
|
|
318
|
-
)
|
|
319
|
-
)) {
|
|
320
|
-
let lastImport = target.program.body.findLastIndex((n) => n.type === "ImportDeclaration");
|
|
321
|
-
target.program.body.splice(lastImport + 1, 0, sourceNode);
|
|
322
|
-
}
|
|
323
|
-
} else if (sourceNode.type === "ExportDefaultDeclaration") {
|
|
324
|
-
let exportDefault = target.program.body.find((n) => n.type === "ExportDefaultDeclaration");
|
|
325
|
-
if (exportDefault && sourceNode.declaration.type === "CallExpression" && sourceNode.declaration.arguments.length > 0 && sourceNode.declaration.arguments[0].type === "ObjectExpression") {
|
|
326
|
-
let { properties } = sourceNode.declaration.arguments[0], targetConfigObject = getWritableTargetConfigObject(target, exportDefault);
|
|
327
|
-
if (targetConfigObject !== null)
|
|
328
|
-
mergeTemplateIntoConfigObject(targetConfigObject, properties, target), updated = !0;
|
|
329
|
-
else {
|
|
330
|
-
let mergeConfigCall = getEffectiveMergeConfigCall(exportDefault.declaration, target);
|
|
331
|
-
if (mergeConfigCall && mergeConfigCall.arguments.length >= 2) {
|
|
332
|
-
let configObjectNodes = [];
|
|
333
|
-
for (let arg of mergeConfigCall.arguments) {
|
|
334
|
-
let configObject = getConfigObjectFromMergeArg(arg, target);
|
|
335
|
-
configObject && configObjectNodes.push(configObject);
|
|
336
|
-
}
|
|
337
|
-
let targetConfigObject2 = configObjectNodes.find(
|
|
338
|
-
(obj) => obj.properties.some(
|
|
339
|
-
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test"
|
|
340
|
-
)
|
|
341
|
-
) || configObjectNodes[0];
|
|
342
|
-
if (!targetConfigObject2)
|
|
343
|
-
return !1;
|
|
344
|
-
mergeTemplateIntoConfigObject(targetConfigObject2, properties, target), updated = !0;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
272
|
+
let candidates = mergeConfigCall.arguments.map((arg) => getConfigObjectFromMergeArg(arg, program)).filter((object) => object !== null);
|
|
273
|
+
return candidates.find((object) => findNamedProp(object.properties, "test")) ?? candidates[0] ?? null;
|
|
274
|
+
}, importedExport = (binding) => {
|
|
275
|
+
if (binding.kind !== "import" || binding.declaration?.type !== "ImportDeclaration")
|
|
276
|
+
return;
|
|
277
|
+
let specifier = binding.node, source = binding.declaration.source.value.replace(/^node:/, ""), name = specifier.type === "ImportNamespaceSpecifier" ? "*" : specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.imported.type === "Literal" ? specifier.imported.value : specifier.imported.name;
|
|
278
|
+
return `${name === "default" && isBuiltin(source) ? "*" : name} from ${source}`;
|
|
279
|
+
}, hasConflictingBinding = (source, target, at) => {
|
|
280
|
+
let scope = target.scopes.scopeOf(at), call = findExportDefault(source.program)?.declaration;
|
|
281
|
+
return [...source.scopes.program.bindings.values()].some((binding) => {
|
|
282
|
+
let existing = scope.lookup(binding.name), merged = binding.references.some((reference) => reference !== call.callee), imported = importedExport(binding);
|
|
283
|
+
return merged && existing && (!imported || importedExport(existing) !== imported);
|
|
284
|
+
});
|
|
285
|
+
}, missingStatements = (source, target) => {
|
|
286
|
+
let declared = (name) => target.scopes.program.bindings.has(name);
|
|
287
|
+
return source.program.body.flatMap((node) => {
|
|
288
|
+
let text = source.source(statementSpan(source, node));
|
|
289
|
+
if (node.type === "ImportDeclaration") {
|
|
290
|
+
let name = node.specifiers[0]?.local.name;
|
|
291
|
+
return name && !declared(name) ? [text] : [];
|
|
292
|
+
}
|
|
293
|
+
if (node.type === "VariableDeclaration") {
|
|
294
|
+
let id = node.declarations[0]?.id;
|
|
295
|
+
return id?.type === "Identifier" && !declared(id.name) ? [text] : [];
|
|
348
296
|
}
|
|
349
|
-
|
|
297
|
+
return [];
|
|
298
|
+
});
|
|
299
|
+
}, updateConfigFile = (sourceCode, target) => {
|
|
300
|
+
let source = new SourceEditor2(sourceCode), templateConfig = () => {
|
|
301
|
+
let declaration = findExportDefault(source.program)?.declaration;
|
|
302
|
+
return declaration?.type === "CallExpression" && declaration.arguments[0]?.type === "ObjectExpression" ? declaration.arguments[0] : null;
|
|
303
|
+
}, exportDefault = findExportDefault(target.program), targetConfig = exportDefault && findWritableConfigObject(target.program, exportDefault);
|
|
304
|
+
if (!templateConfig() || !targetConfig || hasConflictingBinding(source, target, targetConfig))
|
|
305
|
+
return !1;
|
|
306
|
+
let statements = missingStatements(source, target);
|
|
307
|
+
return statements.length > 0 && insertAfterImports2(target, statements.join(`
|
|
308
|
+
`)), mergeTemplateIntoConfigObject({ source, target }, targetConfig, () => templateConfig()), target.commit(), !0;
|
|
350
309
|
};
|
|
351
310
|
|
|
352
311
|
// src/postinstall.ts
|
|
@@ -417,7 +376,7 @@ async function postInstall(options) {
|
|
|
417
376
|
let isAngularVite = info.framework === SupportedFramework.ANGULAR_VITE, maybeWireAngular = async (filePath, content) => {
|
|
418
377
|
if (!isAngularVite || isAngularVitestAlreadyWired(content))
|
|
419
378
|
return;
|
|
420
|
-
let injected = injectAngularVitestIntoConfig(content);
|
|
379
|
+
let injected = injectAngularVitestIntoConfig(content, filePath);
|
|
421
380
|
if (injected === null) {
|
|
422
381
|
logger.error(import_ts_dedent.dedent`
|
|
423
382
|
We configured @storybook/addon-vitest, but could not automatically add the
|
|
@@ -440,15 +399,15 @@ async function postInstall(options) {
|
|
|
440
399
|
if (!alreadyConfigured) {
|
|
441
400
|
let configTemplate = await loadTemplate("vitest.config.4.template", {
|
|
442
401
|
CONFIG_DIR: getTemplateConfigDir(rootConfig, options.configDir)
|
|
443
|
-
})
|
|
444
|
-
target =
|
|
402
|
+
});
|
|
403
|
+
target = new SourceEditor3(configFile, rootConfig), updated = updateConfigFile(configTemplate, target);
|
|
445
404
|
}
|
|
446
405
|
if (alreadyConfigured)
|
|
447
406
|
await maybeWireAngular(rootConfig, configFile), logger.step(
|
|
448
407
|
CLI_COLORS.success("Vitest for Storybook is already properly configured. Skipping setup.")
|
|
449
408
|
);
|
|
450
409
|
else if (target && updated) {
|
|
451
|
-
logger.step(`Updating your ${vitestConfigFile ? "Vitest" : "Vite"} config file:`), logger.log(` ${rootConfig}`), isAngularVite && !isAngularVitestAlreadyWired(configFile) && (
|
|
410
|
+
logger.step(`Updating your ${vitestConfigFile ? "Vitest" : "Vite"} config file:`), logger.log(` ${rootConfig}`), isAngularVite && !isAngularVitestAlreadyWired(configFile) && (injectAngularVitestIntoEditor(target) ? logger.step("Added the @storybook/angular-vite standalone-vitest bridge.") : (logger.error(import_ts_dedent.dedent`
|
|
452
411
|
We configured @storybook/addon-vitest, but could not automatically add the
|
|
453
412
|
@storybook/angular-vite standalone-vitest bridge to:
|
|
454
413
|
${rootConfig}
|
|
@@ -457,11 +416,14 @@ async function postInstall(options) {
|
|
|
457
416
|
and import it from "@storybook/angular-vite/vitest". See:
|
|
458
417
|
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup-advanced
|
|
459
418
|
`), errors.push(new AddonVitestPostinstallConfigUpdateError({ filePath: rootConfig }))));
|
|
460
|
-
let formattedContent = await formatFileContent(rootConfig,
|
|
419
|
+
let formattedContent = await formatFileContent(rootConfig, target.toString());
|
|
461
420
|
await writeFile(
|
|
462
421
|
rootConfig,
|
|
463
|
-
!configFileHasTypeReference && !vitestConfigFile ?
|
|
464
|
-
|
|
422
|
+
!configFileHasTypeReference && !vitestConfigFile ? restoreLineEndings(
|
|
423
|
+
`/// <reference types="vitest/config" />
|
|
424
|
+
` + formattedContent,
|
|
425
|
+
formattedContent
|
|
426
|
+
) : formattedContent
|
|
465
427
|
);
|
|
466
428
|
} else
|
|
467
429
|
logger.error(import_ts_dedent.dedent`
|
|
@@ -477,7 +439,7 @@ async function postInstall(options) {
|
|
|
477
439
|
logger.step("Creating a Vitest config file:"), logger.log(`${newConfigFile}`);
|
|
478
440
|
let configContent = configTemplate;
|
|
479
441
|
if (isAngularVite) {
|
|
480
|
-
let injected = injectAngularVitestIntoConfig(configTemplate);
|
|
442
|
+
let injected = injectAngularVitestIntoConfig(configTemplate, newConfigFile);
|
|
481
443
|
injected !== null && (configContent = injected, logger.step("Added the @storybook/angular-vite standalone-vitest bridge."));
|
|
482
444
|
}
|
|
483
445
|
let formattedContent = await formatFileContent(newConfigFile, configContent);
|
|
@@ -507,32 +469,21 @@ async function postInstall(options) {
|
|
|
507
469
|
function isStorybookTestPluginSource(value) {
|
|
508
470
|
return value === STORYBOOK_TEST_PLUGIN_SOURCE2;
|
|
509
471
|
}
|
|
510
|
-
function isConfigAlreadySetup(
|
|
511
|
-
let
|
|
472
|
+
function isConfigAlreadySetup(configPath, configContent) {
|
|
473
|
+
let program;
|
|
512
474
|
try {
|
|
513
|
-
|
|
475
|
+
({ program } = parseModule(configContent, configPath));
|
|
514
476
|
} catch {
|
|
515
477
|
return !1;
|
|
516
478
|
}
|
|
517
|
-
let pluginIdentifiers = /* @__PURE__ */ new Set();
|
|
518
|
-
|
|
519
|
-
ImportDeclaration(
|
|
520
|
-
let source = path.node.source.value;
|
|
521
|
-
typeof source == "string" && isStorybookTestPluginSource(source) && path.node.specifiers.forEach((specifier) => {
|
|
522
|
-
"local" in specifier && specifier.local?.name && pluginIdentifiers.add(specifier.local.name);
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
});
|
|
479
|
+
let pluginIdentifiers = /* @__PURE__ */ new Set(["storybookTest"]);
|
|
480
|
+
for (let node of program.body)
|
|
481
|
+
node.type === "ImportDeclaration" && isStorybookTestPluginSource(node.source.value) && node.specifiers.forEach((specifier) => pluginIdentifiers.add(specifier.local.name));
|
|
526
482
|
let pluginReferenced = !1;
|
|
527
|
-
return
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
let callee = path.node.callee;
|
|
534
|
-
callee.type === "Identifier" && (pluginIdentifiers.has(callee.name) || callee.name === "storybookTest") && (pluginReferenced = !0, path.stop());
|
|
535
|
-
}
|
|
483
|
+
return walk2(program, (node) => {
|
|
484
|
+
if (pluginReferenced)
|
|
485
|
+
return !1;
|
|
486
|
+
node.type === "CallExpression" && node.callee.type === "Identifier" && pluginIdentifiers.has(node.callee.name) && (pluginReferenced = !0);
|
|
536
487
|
}), pluginReferenced;
|
|
537
488
|
}
|
|
538
489
|
export {
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
globalThis_,
|
|
15
15
|
log,
|
|
16
16
|
noop
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-BHE6WXVW.js";
|
|
18
18
|
import {
|
|
19
19
|
require_picocolors
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-UKLH76WC.js";
|
|
21
21
|
import {
|
|
22
22
|
require_dist
|
|
23
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-ZGTRYRYR.js";
|
|
24
24
|
import {
|
|
25
25
|
normalize
|
|
26
|
-
} from "./_node-chunks/chunk-
|
|
26
|
+
} from "./_node-chunks/chunk-LRDGLC63.js";
|
|
27
27
|
import {
|
|
28
28
|
ADDON_ID2 as ADDON_ID,
|
|
29
29
|
COVERAGE_DIRECTORY,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
TRIGGER_TEST_RUN_REQUEST,
|
|
36
36
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
37
37
|
storeOptions
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-2KSL6GBQ.js";
|
|
39
39
|
import {
|
|
40
40
|
require_compare,
|
|
41
41
|
require_constants,
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
require_parse_options,
|
|
46
46
|
require_re,
|
|
47
47
|
require_semver
|
|
48
|
-
} from "./_node-chunks/chunk-
|
|
48
|
+
} from "./_node-chunks/chunk-ZS2H7IJD.js";
|
|
49
49
|
import {
|
|
50
50
|
__commonJS,
|
|
51
51
|
__toESM
|
|
52
|
-
} from "./_node-chunks/chunk-
|
|
52
|
+
} from "./_node-chunks/chunk-PYGCQ2XJ.js";
|
|
53
53
|
|
|
54
54
|
// ../../../node_modules/semver/functions/parse.js
|
|
55
55
|
var require_parse = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-PYGCQ2XJ.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_162sfnrfbdc from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_162sfnrfbdc from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_162sfnrfbdc from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_162sfnrfbdc.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_162sfnrfbdc.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_162sfnrfbdc.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-UKLH76WC.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-ZGTRYRYR.js";
|
|
18
18
|
import {
|
|
19
19
|
join,
|
|
20
20
|
normalize,
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
relative,
|
|
23
23
|
resolve,
|
|
24
24
|
sep
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-LRDGLC63.js";
|
|
26
26
|
import {
|
|
27
27
|
STORYBOOK_CORE_GHOST_STORIES_PROVIDE_KEY,
|
|
28
28
|
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
29
29
|
STORYBOOK_TEST_FEATURES_PROVIDE_KEY,
|
|
30
30
|
STORYBOOK_TEST_INITIAL_GLOBALS_PROVIDE_KEY
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
31
|
+
} from "../_node-chunks/chunk-2KSL6GBQ.js";
|
|
32
32
|
import {
|
|
33
33
|
__commonJS,
|
|
34
34
|
__esm,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
__require,
|
|
37
37
|
__toCommonJS,
|
|
38
38
|
__toESM
|
|
39
|
-
} from "../_node-chunks/chunk-
|
|
39
|
+
} from "../_node-chunks/chunk-PYGCQ2XJ.js";
|
|
40
40
|
|
|
41
41
|
// ../../../node_modules/braces/lib/utils.js
|
|
42
42
|
var require_utils = __commonJS({
|
|
@@ -2474,8 +2474,8 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
|
|
|
2474
2474
|
let previewConfigPath = getInterpretedFile(join(resolve(configDir), "preview"));
|
|
2475
2475
|
if (!previewConfigPath)
|
|
2476
2476
|
return [];
|
|
2477
|
-
let previewConfig = await readConfig(previewConfigPath), tags = previewConfig.getValue(["tags"])
|
|
2478
|
-
if (
|
|
2477
|
+
let previewConfig = await readConfig(previewConfigPath), tags = previewConfig.inspect(["tags"]).kind === "value" ? previewConfig.getValue(["tags"]) : [];
|
|
2478
|
+
if (!Array.isArray(tags) || !tags.every((tag) => typeof tag == "string"))
|
|
2479
2479
|
throw new HandledError("Preview tags must be a static array of strings");
|
|
2480
2480
|
return tags;
|
|
2481
2481
|
}, getStoryGlobsAndFiles = async (presets, directories) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.8",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"@storybook/icons": "^2.0.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@storybook/addon-a11y": "11.0.0-alpha.
|
|
85
|
-
"@storybook/builder-vite": "11.0.0-alpha.
|
|
84
|
+
"@storybook/addon-a11y": "11.0.0-alpha.8",
|
|
85
|
+
"@storybook/builder-vite": "11.0.0-alpha.8",
|
|
86
86
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
87
87
|
"@types/micromatch": "^4.0.0",
|
|
88
88
|
"@types/node": "^22.19.1",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@vitest/browser": "^4.0.0 || ^5.0.0",
|
|
112
112
|
"@vitest/browser-playwright": "^4.0.0 || ^5.0.0",
|
|
113
|
-
"storybook": "^11.0.0-alpha.
|
|
113
|
+
"storybook": "^11.0.0-alpha.8",
|
|
114
114
|
"vitest": "^4.0.0 || ^5.0.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependenciesMeta": {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
2
|
|
|
4
3
|
import { defineConfig } from 'vitest/config';
|
|
5
4
|
|
|
@@ -7,9 +6,6 @@ import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
|
7
6
|
|
|
8
7
|
import { playwright } from '@vitest/browser-playwright';
|
|
9
8
|
|
|
10
|
-
const dirname =
|
|
11
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
|
|
13
9
|
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
14
10
|
export default defineConfig({
|
|
15
11
|
test: {
|
|
@@ -19,7 +15,7 @@ export default defineConfig({
|
|
|
19
15
|
plugins: [
|
|
20
16
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
21
17
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
22
|
-
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
18
|
+
storybookTest({ configDir: path.join(import.meta.dirname, 'CONFIG_DIR') }),
|
|
23
19
|
],
|
|
24
20
|
test: {
|
|
25
21
|
name: 'storybook',
|