@storybook/addon-vitest 11.0.0-alpha.6 → 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-2KCBNFEY.js → chunk-2KSL6GBQ.js} +6 -6
- package/dist/_node-chunks/{chunk-CBTDG3NS.js → chunk-6NTJLCDE.js} +6 -6
- package/dist/_node-chunks/{chunk-2YKI7DW2.js → chunk-BHE6WXVW.js} +9 -9
- package/dist/_node-chunks/{chunk-GHJVOTQS.js → chunk-LRDGLC63.js} +6 -6
- package/dist/_node-chunks/{chunk-BQV6NIJ6.js → chunk-PYGCQ2XJ.js} +6 -6
- package/dist/_node-chunks/{chunk-5D6KK45I.js → chunk-UKLH76WC.js} +7 -7
- package/dist/_node-chunks/{chunk-PVSSJVWV.js → chunk-ZGTRYRYR.js} +7 -7
- package/dist/_node-chunks/{chunk-5GHDCRJY.js → chunk-ZS2H7IJD.js} +7 -7
- package/dist/_node-chunks/{vitest.config.4.template-YC3ONBFK.js → vitest.config.4.template-CWGQLSCP.js} +8 -12
- package/dist/constants.js +8 -8
- package/dist/node/coverage-reporter.js +12 -12
- package/dist/node/vitest.js +31 -24
- package/dist/postinstall.js +245 -294
- package/dist/preset.js +86 -27
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +19 -18
- package/dist/vitest-plugin/test-utils.js +8 -1
- 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({
|
|
@@ -1335,18 +1335,18 @@ var require_istanbul_lib_report = __commonJS({
|
|
|
1335
1335
|
|
|
1336
1336
|
// src/node/coverage-reporter.ts
|
|
1337
1337
|
var import_istanbul_lib_report = __toESM(require_istanbul_lib_report(), 1), StorybookCoverageReporter = class extends import_istanbul_lib_report.ReportBase {
|
|
1338
|
-
#
|
|
1338
|
+
#getTestManager;
|
|
1339
1339
|
constructor(opts) {
|
|
1340
|
-
super(), this.#
|
|
1340
|
+
super(), this.#getTestManager = opts.getTestManager;
|
|
1341
1341
|
}
|
|
1342
1342
|
onSummary(node) {
|
|
1343
1343
|
if (!node.isRoot())
|
|
1344
1344
|
return;
|
|
1345
|
-
let rawCoverageSummary = node.getCoverageSummary(!1), percentage = Math.round(rawCoverageSummary.data.statements.pct), [lowWatermark = 50, highWatermark = 80] =
|
|
1345
|
+
let testManager = this.#getTestManager(), rawCoverageSummary = node.getCoverageSummary(!1), percentage = Math.round(rawCoverageSummary.data.statements.pct), [lowWatermark = 50, highWatermark = 80] = testManager.vitestManager.vitest?.config.coverage.watermarks?.statements ?? [], coverageSummary = {
|
|
1346
1346
|
percentage,
|
|
1347
1347
|
status: percentage < lowWatermark ? "negative" : percentage < highWatermark ? "warning" : "positive"
|
|
1348
1348
|
};
|
|
1349
|
-
|
|
1349
|
+
testManager.onCoverageCollected(coverageSummary);
|
|
1350
1350
|
}
|
|
1351
1351
|
}, coverage_reporter_default = StorybookCoverageReporter;
|
|
1352
1352
|
export {
|
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";
|
|
@@ -188,23 +188,27 @@ var DOUBLE_SPACES = " ", getTestName = (name) => `${name}${DOUBLE_SPACES}`, Vit
|
|
|
188
188
|
this.vitestStartupCounter = 0;
|
|
189
189
|
this.vitestRestartPromise = null;
|
|
190
190
|
this.runningPromise = null;
|
|
191
|
+
// Tracked here because `vitest.config.coverage.enabled` does not follow `disableCoverage()`.
|
|
192
|
+
this.coverageEnabled = !1;
|
|
191
193
|
}
|
|
192
194
|
async startVitest({ coverage }) {
|
|
193
195
|
let { createVitest, version } = await import("vitest/node");
|
|
194
196
|
this.testNameSeparator = Number.parseInt(version, 10) >= 5 ? " > " : " ";
|
|
195
|
-
let
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
testManager: this.testManager
|
|
199
|
-
}
|
|
200
|
-
], coverageOptions = coverage ? {
|
|
201
|
-
enabled: !0,
|
|
197
|
+
let coverageOptions = {
|
|
198
|
+
enabled: coverage,
|
|
202
199
|
clean: !0,
|
|
203
200
|
cleanOnRerun: !0,
|
|
204
201
|
reportOnFailure: !0,
|
|
205
|
-
reporter: [["html", {}],
|
|
202
|
+
reporter: [["html", {}], [
|
|
203
|
+
"@storybook/addon-vitest/internal/coverage-reporter",
|
|
204
|
+
{
|
|
205
|
+
// A function, not the manager itself: Vitest deep-clones coverage options when coverage
|
|
206
|
+
// is toggled at runtime, and the reporter must reach the live manager.
|
|
207
|
+
getTestManager: () => this.testManager
|
|
208
|
+
}
|
|
209
|
+
]],
|
|
206
210
|
reportsDirectory: resolvePathInStorybookCache(COVERAGE_DIRECTORY)
|
|
207
|
-
}
|
|
211
|
+
}, configDir = this.testManager.storybookOptions.configDir, packageRoot = configDir ? dirname(resolve(configDir)) : void 0, configFiles = [
|
|
208
212
|
...VITEST_CONFIG_FILE_EXTENSIONS.flatMap((ext) => [
|
|
209
213
|
`vitest.config.${ext}`,
|
|
210
214
|
`vite.config.${ext}`
|
|
@@ -245,7 +249,7 @@ var DOUBLE_SPACES = " ", getTestName = (name) => `${name}${DOUBLE_SPACES}`, Vit
|
|
|
245
249
|
// Otherwise it might be hard for the user to discover Storybook related logs
|
|
246
250
|
reporters: ["default", new StorybookReporter(this.testManager)],
|
|
247
251
|
coverage: coverageOptions
|
|
248
|
-
});
|
|
252
|
+
}), this.coverageEnabled = coverage;
|
|
249
253
|
} catch (err) {
|
|
250
254
|
let originalMessage = String(err.message);
|
|
251
255
|
if (originalMessage.includes("Found multiple projects")) {
|
|
@@ -284,6 +288,9 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
284
288
|
}
|
|
285
289
|
}), this.vitestRestartPromise;
|
|
286
290
|
}
|
|
291
|
+
async setCoverage(enabled) {
|
|
292
|
+
await this.vitestRestartPromise, !(!this.vitest || this.coverageEnabled === enabled) && (await this.cancelCurrentRun(), enabled ? await this.vitest.enableCoverage() : this.vitest.disableCoverage(), this.coverageEnabled = enabled);
|
|
293
|
+
}
|
|
287
294
|
resetGlobalTestNamePattern() {
|
|
288
295
|
this.vitest?.setGlobalTestNamePattern("");
|
|
289
296
|
}
|
|
@@ -360,8 +367,8 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
360
367
|
this.vitest?.provide(STORYBOOK_TEST_PROVIDE_KEY, this.getCurrentRunConfig());
|
|
361
368
|
}
|
|
362
369
|
async runTests(runPayload) {
|
|
363
|
-
let { watching } = this.testManager.store.getState(), coverageShouldBeEnabled = !!this.getCurrentRunConfig().coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0
|
|
364
|
-
this.vitest ?
|
|
370
|
+
let { watching } = this.testManager.store.getState(), coverageShouldBeEnabled = !!this.getCurrentRunConfig().coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0;
|
|
371
|
+
this.vitest ? await this.setCoverage(coverageShouldBeEnabled) : await this.startVitest({ coverage: coverageShouldBeEnabled }), this.provideRunConfig(), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
365
372
|
let testSpecifications = await this.getStorybookTestSpecifications(), allStories = this.getStories(), filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
366
373
|
if (runPayload.storyIds?.length) {
|
|
367
374
|
let regex = this.buildTestNamePatternForStories(filteredStories, allStories);
|