@storybook/addon-vitest 0.0.0-pr-33458-sha-b3ad27e9 → 0.0.0-pr-33365-sha-d28e8fe8
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-PDWNPHLS.js → chunk-4TUFDYLN.js} +6 -6
- package/dist/_node-chunks/{chunk-Q7JX5YVT.js → chunk-5G4JGNO2.js} +7 -7
- package/dist/_node-chunks/{chunk-D75VSZW7.js → chunk-5O7SAHGW.js} +7 -7
- package/dist/_node-chunks/{chunk-POU7D76O.js → chunk-BSBLNKIU.js} +7 -7
- package/dist/_node-chunks/{chunk-ZUGWGEUA.js → chunk-BUJNQJQC.js} +6 -6
- package/dist/_node-chunks/{chunk-3AZWGHDG.js → chunk-KEOLLNOI.js} +9 -9
- package/dist/_node-chunks/{chunk-K7B5HKN6.js → chunk-KZK5CHEO.js} +6 -6
- package/dist/_node-chunks/{chunk-VDFYMOCL.js → chunk-UVCU73GZ.js} +6 -6
- package/dist/_node-chunks/{chunk-TWPT443N.js → chunk-XHOGP22F.js} +7 -7
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +55 -147
- package/dist/postinstall.js +18 -18
- package/dist/preset.js +18 -54
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +10 -10
- package/dist/vitest-plugin/test-utils.js +2 -11
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-BUJNQJQC.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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_rbsbl8boobn.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4TUFDYLN.js";
|
|
16
16
|
|
|
17
17
|
// ../../core/src/shared/utils/module.ts
|
|
18
18
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-BUJNQJQC.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-KZK5CHEO.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BSBLNKIU.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BUJNQJQC.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_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-BUJNQJQC.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-5G4JGNO2.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-BUJNQJQC.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,35 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-KEOLLNOI.js";
|
|
15
15
|
import {
|
|
16
16
|
any
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-UVCU73GZ.js";
|
|
18
18
|
import {
|
|
19
19
|
ADDON_ID,
|
|
20
20
|
COVERAGE_DIRECTORY,
|
|
21
21
|
STATUS_TYPE_ID_A11Y,
|
|
22
22
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
23
23
|
storeOptions
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
25
|
-
import "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-KZK5CHEO.js";
|
|
25
|
+
import "../_node-chunks/chunk-BSBLNKIU.js";
|
|
26
26
|
import {
|
|
27
27
|
dirname,
|
|
28
28
|
join,
|
|
29
29
|
normalize,
|
|
30
30
|
path
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
32
|
-
import "../_node-chunks/chunk-
|
|
31
|
+
} from "../_node-chunks/chunk-4TUFDYLN.js";
|
|
32
|
+
import "../_node-chunks/chunk-BUJNQJQC.js";
|
|
33
33
|
|
|
34
34
|
// src/node/vitest.ts
|
|
35
35
|
import process2 from "node:process";
|
|
@@ -55,7 +55,7 @@ function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
|
55
55
|
}, cancel = () => {
|
|
56
56
|
cancelTimer(), pendingThis = void 0, pendingArgs = null;
|
|
57
57
|
}, flush = () => {
|
|
58
|
-
invoke();
|
|
58
|
+
cancelTimer(), invoke();
|
|
59
59
|
}, debounced = function(...args) {
|
|
60
60
|
if (signal?.aborted)
|
|
61
61
|
return;
|
|
@@ -99,14 +99,8 @@ var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
|
|
|
99
99
|
|
|
100
100
|
// ../../../node_modules/es-toolkit/dist/function/throttle.mjs
|
|
101
101
|
function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) {
|
|
102
|
-
let pendingAt = null, debounced = debounce(function(...args) {
|
|
103
|
-
pendingAt = Date.now(),
|
|
104
|
-
}, throttleMs, { signal, edges }), throttled = function(...args) {
|
|
105
|
-
if (pendingAt == null && (pendingAt = Date.now()), Date.now() - pendingAt >= throttleMs) {
|
|
106
|
-
pendingAt = Date.now(), func.apply(this, args), debounced.cancel(), debounced.schedule();
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
debounced.apply(this, args);
|
|
102
|
+
let pendingAt = null, debounced = debounce(func, throttleMs, { signal, edges }), throttled = function(...args) {
|
|
103
|
+
pendingAt == null ? pendingAt = Date.now() : Date.now() - pendingAt >= throttleMs && (pendingAt = Date.now(), debounced.cancel()), debounced(...args);
|
|
110
104
|
};
|
|
111
105
|
return throttled.cancel = debounced.cancel, throttled.flush = debounced.flush, throttled;
|
|
112
106
|
}
|
|
@@ -117,7 +111,7 @@ function errorToErrorLike(error) {
|
|
|
117
111
|
message: error.message,
|
|
118
112
|
name: error.name,
|
|
119
113
|
// avoid duplicating the error message in the stack trace
|
|
120
|
-
stack: error.
|
|
114
|
+
stack: error.stack?.replace(error.message, ""),
|
|
121
115
|
cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
|
|
122
116
|
};
|
|
123
117
|
}
|
|
@@ -133,19 +127,18 @@ function slash(path2) {
|
|
|
133
127
|
|
|
134
128
|
// src/node/reporter.ts
|
|
135
129
|
var StorybookReporter = class {
|
|
136
|
-
constructor(
|
|
137
|
-
this.testManager =
|
|
130
|
+
constructor(testManager) {
|
|
131
|
+
this.testManager = testManager;
|
|
138
132
|
}
|
|
139
133
|
onInit(ctx) {
|
|
140
134
|
this.ctx = ctx;
|
|
141
135
|
}
|
|
142
136
|
onTestCaseResult(testCase) {
|
|
143
|
-
let { storyId, reports
|
|
137
|
+
let { storyId, reports } = testCase.meta(), testResult = testCase.result();
|
|
144
138
|
this.testManager.onTestCaseResult({
|
|
145
139
|
storyId,
|
|
146
140
|
testResult,
|
|
147
|
-
reports
|
|
148
|
-
componentPath
|
|
141
|
+
reports
|
|
149
142
|
});
|
|
150
143
|
}
|
|
151
144
|
async onTestRunEnd(testModules, unhandledErrors) {
|
|
@@ -173,14 +166,14 @@ var StorybookReporter = class {
|
|
|
173
166
|
var VITEST_CONFIG_FILE_EXTENSIONS = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"], VITEST_WORKSPACE_FILE_EXTENSION = ["ts", "js", "json"];
|
|
174
167
|
process.env.VITEST_STORYBOOK = "true";
|
|
175
168
|
var DOUBLE_SPACES = " ", getTestName = (name) => `${name}${DOUBLE_SPACES}`, VitestManager = class {
|
|
176
|
-
constructor(
|
|
177
|
-
this.testManager =
|
|
169
|
+
constructor(testManager) {
|
|
170
|
+
this.testManager = testManager;
|
|
178
171
|
this.vitest = null;
|
|
179
172
|
this.vitestStartupCounter = 0;
|
|
180
173
|
this.vitestRestartPromise = null;
|
|
181
174
|
this.runningPromise = null;
|
|
182
175
|
}
|
|
183
|
-
async startVitest({ coverage
|
|
176
|
+
async startVitest({ coverage }) {
|
|
184
177
|
let { createVitest } = await import("vitest/node"), storybookCoverageReporter = [
|
|
185
178
|
"@storybook/addon-vitest/internal/coverage-reporter",
|
|
186
179
|
{
|
|
@@ -199,22 +192,22 @@ var DOUBLE_SPACES = " ", getTestName = (name) => `${name}${DOUBLE_SPACES}`, Vit
|
|
|
199
192
|
...VITEST_WORKSPACE_FILE_EXTENSION.map((ext) => `vitest.workspace.${ext}`),
|
|
200
193
|
...VITEST_CONFIG_FILE_EXTENSIONS.map((ext) => `vitest.config.${ext}`)
|
|
201
194
|
],
|
|
202
|
-
{
|
|
203
|
-
),
|
|
204
|
-
root: vitestWorkspaceConfig ? dirname(vitestWorkspaceConfig) : process.cwd(),
|
|
205
|
-
watch: watch ?? !1,
|
|
206
|
-
passWithNoTests: !1,
|
|
207
|
-
// TODO:
|
|
208
|
-
// Do we want to enable Vite's default reporter?
|
|
209
|
-
// The output in the terminal might be too spamy and it might be better to
|
|
210
|
-
// find a way to just show errors and warnings for example
|
|
211
|
-
// Otherwise it might be hard for the user to discover Storybook related logs
|
|
212
|
-
reporters: ["default", new StorybookReporter(this.testManager)],
|
|
213
|
-
coverage: coverageOptions
|
|
214
|
-
};
|
|
215
|
-
shouldUseProjectFilter && projectName && (vitestConfig.project = [projectName]);
|
|
195
|
+
{ last: getProjectRoot() }
|
|
196
|
+
), projectName = "storybook:" + process.env.STORYBOOK_CONFIG_DIR;
|
|
216
197
|
try {
|
|
217
|
-
this.vitest = await createVitest("test",
|
|
198
|
+
this.vitest = await createVitest("test", {
|
|
199
|
+
root: vitestWorkspaceConfig ? dirname(vitestWorkspaceConfig) : process.cwd(),
|
|
200
|
+
watch: !0,
|
|
201
|
+
passWithNoTests: !1,
|
|
202
|
+
project: [projectName],
|
|
203
|
+
// TODO:
|
|
204
|
+
// Do we want to enable Vite's default reporter?
|
|
205
|
+
// The output in the terminal might be too spamy and it might be better to
|
|
206
|
+
// find a way to just show errors and warnings for example
|
|
207
|
+
// Otherwise it might be hard for the user to discover Storybook related logs
|
|
208
|
+
reporters: ["default", new StorybookReporter(this.testManager)],
|
|
209
|
+
coverage: coverageOptions
|
|
210
|
+
});
|
|
218
211
|
} catch (err) {
|
|
219
212
|
let originalMessage = String(err.message);
|
|
220
213
|
if (originalMessage.includes("Found multiple projects")) {
|
|
@@ -242,10 +235,10 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
242
235
|
}
|
|
243
236
|
await this.setupWatchers();
|
|
244
237
|
}
|
|
245
|
-
async restartVitest({ coverage
|
|
238
|
+
async restartVitest({ coverage }) {
|
|
246
239
|
return await this.vitestRestartPromise, this.vitestRestartPromise = new Promise(async (resolve, reject) => {
|
|
247
240
|
try {
|
|
248
|
-
await this.runningPromise, await this.vitest?.close(), await this.startVitest({ coverage
|
|
241
|
+
await this.runningPromise, await this.vitest?.close(), await this.startVitest({ coverage }), resolve();
|
|
249
242
|
} catch (e) {
|
|
250
243
|
reject(e);
|
|
251
244
|
} finally {
|
|
@@ -291,18 +284,9 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
291
284
|
}
|
|
292
285
|
return { filteredTestSpecifications, filteredStoryIds };
|
|
293
286
|
}
|
|
294
|
-
async runTests(runPayload
|
|
295
|
-
let { watching, config } = this.testManager.store.getState(), coverageShouldBeEnabled = config.coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0, currentCoverage = this.vitest?.config.coverage?.enabled
|
|
296
|
-
|
|
297
|
-
shouldWatch,
|
|
298
|
-
triggeredBy,
|
|
299
|
-
currentVitestWatch: this.vitest?.config.watch
|
|
300
|
-
}), this.vitest ? currentCoverage !== coverageShouldBeEnabled || this.vitest.config.watch !== shouldWatch ? (console.log(
|
|
301
|
-
"Restarting Vitest with watch:",
|
|
302
|
-
shouldWatch,
|
|
303
|
-
"current:",
|
|
304
|
-
this.vitest.config.watch
|
|
305
|
-
), await this.restartVitest({ coverage: coverageShouldBeEnabled, watch: shouldWatch })) : (console.log("Using existing Vitest with watch:", this.vitest.config.watch), await this.vitestRestartPromise) : (console.log("Starting Vitest with watch:", shouldWatch), await this.startVitest({ coverage: coverageShouldBeEnabled, watch: shouldWatch })), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
287
|
+
async runTests(runPayload) {
|
|
288
|
+
let { watching, config } = this.testManager.store.getState(), coverageShouldBeEnabled = config.coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0, currentCoverage = this.vitest?.config.coverage?.enabled;
|
|
289
|
+
this.vitest ? currentCoverage !== coverageShouldBeEnabled ? await this.restartVitest({ coverage: coverageShouldBeEnabled }) : await this.vitestRestartPromise : await this.startVitest({ coverage: coverageShouldBeEnabled }), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
306
290
|
let testSpecifications = await this.getStorybookTestSpecifications(), allStories = await this.fetchStories(), filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
307
291
|
if (runPayload.storyIds?.length === 1) {
|
|
308
292
|
let selectedStory = filteredStories.find((story) => story.id === runPayload.storyIds?.[0]);
|
|
@@ -337,53 +321,6 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
337
321
|
async cancelCurrentRun() {
|
|
338
322
|
await this.vitest?.cancelCurrentRun("keyboard-input"), await this.runningPromise;
|
|
339
323
|
}
|
|
340
|
-
/** Run tests for story discovery - completely isolated from UI and normal test flow */
|
|
341
|
-
async runStoryDiscoveryTests(storyIds) {
|
|
342
|
-
if (await this.vitestRestartPromise, !this.vitest)
|
|
343
|
-
throw new Error("Vitest is not initialized yet");
|
|
344
|
-
this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
345
|
-
let testSpecifications = await this.getStorybookTestSpecifications(), allStories = await this.fetchStories(), filteredStories = storyIds ? allStories.filter((story) => storyIds.includes(story.id)) : allStories, { filteredTestSpecifications } = this.filterTestSpecifications(
|
|
346
|
-
testSpecifications,
|
|
347
|
-
filteredStories
|
|
348
|
-
);
|
|
349
|
-
if (filteredTestSpecifications.length === 0)
|
|
350
|
-
return {
|
|
351
|
-
testResults: [],
|
|
352
|
-
testSummary: { total: 0, passed: 0, failed: 0 }
|
|
353
|
-
};
|
|
354
|
-
let testResults = [], totalTests = 0, passedTests = 0, failedTests = 0, silentReporter = new class {
|
|
355
|
-
onTestCaseResult(testCase) {
|
|
356
|
-
let { storyId, reports, componentPath } = testCase.meta(), testResult = testCase.result();
|
|
357
|
-
totalTests++, testResult.state === "passed" ? passedTests++ : testResult.state === "failed" && failedTests++, testResults.push({
|
|
358
|
-
storyId,
|
|
359
|
-
status: testResult.state === "passed" ? "PASS" : testResult.state === "failed" ? "FAIL" : "PENDING",
|
|
360
|
-
componentFilePath: componentPath || "",
|
|
361
|
-
error: testResult.errors?.[0]?.message
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
// Required Reporter methods (no-op for silent reporter)
|
|
365
|
-
onInit() {
|
|
366
|
-
}
|
|
367
|
-
onTestModuleStart() {
|
|
368
|
-
}
|
|
369
|
-
onTestModuleEnd() {
|
|
370
|
-
}
|
|
371
|
-
onTestCaseStart() {
|
|
372
|
-
}
|
|
373
|
-
onTestRunEnd() {
|
|
374
|
-
}
|
|
375
|
-
}(), originalReporters = this.vitest.config.reporters, originalStdoutWrite = process.stdout.write, originalStderrWrite = process.stderr.write;
|
|
376
|
-
this.vitest.config.reporters = [silentReporter];
|
|
377
|
-
try {
|
|
378
|
-
process.stdout.write = () => !0, process.stderr.write = () => !0, await this.vitest.runTestSpecifications(filteredTestSpecifications, !0);
|
|
379
|
-
} finally {
|
|
380
|
-
process.stdout.write = originalStdoutWrite, process.stderr.write = originalStderrWrite, this.vitest.config.reporters = originalReporters, this.resetGlobalTestNamePattern();
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
testResults,
|
|
384
|
-
testSummary: { total: totalTests, passed: passedTests, failed: failedTests }
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
324
|
async getStorybookTestSpecifications() {
|
|
388
325
|
return (await this.vitest?.globTestSpecifications() ?? []).filter(
|
|
389
326
|
(workspaceSpec) => this.isStorybookProject(workspaceSpec.project)
|
|
@@ -454,7 +391,7 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
454
391
|
if (normalize(file) === this.vitest?.vite?.config.configFile) {
|
|
455
392
|
log("Restarting Vitest due to config change");
|
|
456
393
|
let { watching, config } = this.testManager.store.getState();
|
|
457
|
-
await this.restartVitest({ coverage: config.coverage && !watching
|
|
394
|
+
await this.restartVitest({ coverage: config.coverage && !watching });
|
|
458
395
|
}
|
|
459
396
|
});
|
|
460
397
|
}
|
|
@@ -540,10 +477,7 @@ var testStateToStatusValueMap = {
|
|
|
540
477
|
).filter((a11yStatus) => a11yStatus !== void 0);
|
|
541
478
|
a11yStatuses.length > 0 && this.a11yStatusStore.set(a11yStatuses);
|
|
542
479
|
}, 500);
|
|
543
|
-
this.
|
|
544
|
-
coverage: this.store.getState().config.coverage,
|
|
545
|
-
watch: this.store.getState().watching
|
|
546
|
-
})).then(() => this.onReady?.()).catch((e) => {
|
|
480
|
+
this.store = options.store, this.componentTestStatusStore = options.componentTestStatusStore, this.a11yStatusStore = options.a11yStatusStore, this.testProviderStore = options.testProviderStore, this.onReady = options.onReady, this.storybookOptions = options.storybookOptions, this.vitestManager = new VitestManager(this), this.store.subscribe("TRIGGER_RUN", this.handleTriggerRunEvent.bind(this)), this.store.subscribe("CANCEL_RUN", this.handleCancelEvent.bind(this)), this.store.untilReady().then(() => this.vitestManager.startVitest({ coverage: this.store.getState().config.coverage })).then(() => this.onReady?.()).catch((e) => {
|
|
547
481
|
this.reportFatalError("Failed to start Vitest", e);
|
|
548
482
|
});
|
|
549
483
|
}
|
|
@@ -553,7 +487,7 @@ var testStateToStatusValueMap = {
|
|
|
553
487
|
triggeredBy: event.payload.triggeredBy,
|
|
554
488
|
callback: async () => {
|
|
555
489
|
try {
|
|
556
|
-
await this.vitestManager.vitestRestartPromise, await this.vitestManager.runTests(event.payload
|
|
490
|
+
await this.vitestManager.vitestRestartPromise, await this.vitestManager.runTests(event.payload);
|
|
557
491
|
} catch (err) {
|
|
558
492
|
throw this.reportFatalError("Failed to run tests", err), err;
|
|
559
493
|
}
|
|
@@ -590,12 +524,10 @@ var testStateToStatusValueMap = {
|
|
|
590
524
|
config: s.config
|
|
591
525
|
}
|
|
592
526
|
})), process.env.VITEST_STORYBOOK_CONFIG = JSON.stringify(this.store.getState().config), await this.testProviderStore.runWithState(async () => {
|
|
593
|
-
await callback()
|
|
594
|
-
let currentRun = this.store.getState().currentRun;
|
|
595
|
-
if (this.store.send({
|
|
527
|
+
if (await callback(), this.store.send({
|
|
596
528
|
type: "TEST_RUN_COMPLETED",
|
|
597
|
-
payload: currentRun
|
|
598
|
-
}), currentRun.unhandledErrors.length > 0)
|
|
529
|
+
payload: this.store.getState().currentRun
|
|
530
|
+
}), this.store.getState().currentRun.unhandledErrors.length > 0)
|
|
599
531
|
throw new Error("Tests completed but there are unhandled errors");
|
|
600
532
|
});
|
|
601
533
|
}
|
|
@@ -609,8 +541,8 @@ var testStateToStatusValueMap = {
|
|
|
609
541
|
}));
|
|
610
542
|
}
|
|
611
543
|
onTestCaseResult(result) {
|
|
612
|
-
let { storyId, testResult, reports
|
|
613
|
-
storyId && (this.batchedTestCaseResults.push({ storyId, testResult, reports
|
|
544
|
+
let { storyId, testResult, reports } = result;
|
|
545
|
+
storyId && (this.batchedTestCaseResults.push({ storyId, testResult, reports }), this.throttledFlushTestCaseResults());
|
|
614
546
|
}
|
|
615
547
|
onTestRunEnd(endResult) {
|
|
616
548
|
this.throttledFlushTestCaseResults.flush(), this.store.setState((s) => ({
|
|
@@ -643,18 +575,14 @@ var testStateToStatusValueMap = {
|
|
|
643
575
|
}
|
|
644
576
|
static async start(options) {
|
|
645
577
|
return new Promise((resolve) => {
|
|
646
|
-
let
|
|
578
|
+
let testManager = new _TestManager({
|
|
647
579
|
...options,
|
|
648
580
|
onReady: () => {
|
|
649
|
-
resolve(
|
|
581
|
+
resolve(testManager), options.onReady?.();
|
|
650
582
|
}
|
|
651
583
|
});
|
|
652
584
|
});
|
|
653
585
|
}
|
|
654
|
-
/** Run tests for story discovery - completely isolated from UI and normal test flow */
|
|
655
|
-
async runStoryDiscoveryTests(storyIds) {
|
|
656
|
-
return this.vitestManager.runStoryDiscoveryTests(storyIds);
|
|
657
|
-
}
|
|
658
586
|
};
|
|
659
587
|
|
|
660
588
|
// src/node/vitest.ts
|
|
@@ -670,7 +598,8 @@ var UniversalStore = experimental_UniversalStore, getStatusStore = experimental_
|
|
|
670
598
|
}
|
|
671
599
|
});
|
|
672
600
|
UniversalStore.__prepare(channel, UniversalStore.Environment.SERVER);
|
|
673
|
-
var store = UniversalStore.create(storeOptions)
|
|
601
|
+
var store = UniversalStore.create(storeOptions);
|
|
602
|
+
new TestManager({
|
|
674
603
|
store,
|
|
675
604
|
componentTestStatusStore: getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST),
|
|
676
605
|
a11yStatusStore: getStatusStore(STATUS_TYPE_ID_A11Y),
|
|
@@ -678,31 +607,10 @@ var store = UniversalStore.create(storeOptions), testManager = new TestManager({
|
|
|
678
607
|
onReady: () => {
|
|
679
608
|
process2.send?.({ type: "ready" });
|
|
680
609
|
},
|
|
681
|
-
onTestCaseResult: (result) => {
|
|
682
|
-
process2.send?.({
|
|
683
|
-
type: "test-case-result",
|
|
684
|
-
args: [result],
|
|
685
|
-
from: "server"
|
|
686
|
-
});
|
|
687
|
-
},
|
|
688
610
|
storybookOptions: {
|
|
689
611
|
configDir: process2.env.STORYBOOK_CONFIG_DIR || ""
|
|
690
612
|
}
|
|
691
613
|
});
|
|
692
|
-
channel.on("story-discovery-test-run", async (storyIds) => {
|
|
693
|
-
try {
|
|
694
|
-
let results = await testManager.vitestManager.runStoryDiscoveryTests(storyIds);
|
|
695
|
-
process2.send?.({
|
|
696
|
-
type: "story-discovery-result",
|
|
697
|
-
result: results
|
|
698
|
-
});
|
|
699
|
-
} catch (error) {
|
|
700
|
-
process2.send?.({
|
|
701
|
-
type: "story-discovery-error",
|
|
702
|
-
error: error.message
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
614
|
var exit = (code = 0) => {
|
|
707
615
|
channel?.removeAllListeners(), process2.exit(code);
|
|
708
616
|
}, createUnhandledErrorHandler = (message) => async (error) => {
|
package/dist/postinstall.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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
|
resolvePackageDir
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-5O7SAHGW.js";
|
|
15
15
|
import {
|
|
16
16
|
any
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-UVCU73GZ.js";
|
|
18
18
|
import {
|
|
19
19
|
DOCUMENTATION_LINK
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-KZK5CHEO.js";
|
|
21
21
|
import {
|
|
22
22
|
require_dist
|
|
23
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-XHOGP22F.js";
|
|
24
24
|
import {
|
|
25
25
|
dirname,
|
|
26
26
|
join,
|
|
27
27
|
relative,
|
|
28
28
|
resolve
|
|
29
|
-
} from "./_node-chunks/chunk-
|
|
29
|
+
} from "./_node-chunks/chunk-4TUFDYLN.js";
|
|
30
30
|
import {
|
|
31
31
|
require_compare,
|
|
32
32
|
require_constants,
|
|
@@ -36,11 +36,11 @@ import {
|
|
|
36
36
|
require_parse_options,
|
|
37
37
|
require_re,
|
|
38
38
|
require_semver
|
|
39
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-5G4JGNO2.js";
|
|
40
40
|
import {
|
|
41
41
|
__commonJS,
|
|
42
42
|
__toESM
|
|
43
|
-
} from "./_node-chunks/chunk-
|
|
43
|
+
} from "./_node-chunks/chunk-BUJNQJQC.js";
|
|
44
44
|
|
|
45
45
|
// ../../../node_modules/semver/functions/parse.js
|
|
46
46
|
var require_parse = __commonJS({
|
|
@@ -1104,7 +1104,7 @@ async function postInstall(options) {
|
|
|
1104
1104
|
Found an existing Vitest setup file:
|
|
1105
1105
|
${vitestSetupFile}
|
|
1106
1106
|
Please refer to the documentation to complete the setup manually:
|
|
1107
|
-
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1107
|
+
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1108
1108
|
`;
|
|
1109
1109
|
logger.line(), logger.error(`${errorMessage}
|
|
1110
1110
|
`), errors.push(new AddonVitestPostinstallExistingSetupFileError({ filePath: vitestSetupFile }));
|
|
@@ -1153,7 +1153,7 @@ async function postInstall(options) {
|
|
|
1153
1153
|
your existing workspace file automatically, you must do it yourself.
|
|
1154
1154
|
|
|
1155
1155
|
Please refer to the documentation to complete the setup manually:
|
|
1156
|
-
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1156
|
+
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1157
1157
|
`
|
|
1158
1158
|
), errors.push(
|
|
1159
1159
|
new AddonVitestPostinstallWorkspaceUpdateError({ filePath: vitestWorkspaceFile })
|
|
@@ -1182,7 +1182,7 @@ async function postInstall(options) {
|
|
|
1182
1182
|
We were unable to update your existing ${vitestConfigFile ? "Vitest" : "Vite"} config file.
|
|
1183
1183
|
|
|
1184
1184
|
Please refer to the documentation to complete the setup manually:
|
|
1185
|
-
https://storybook.js.org/docs/writing-tests/integrations/vitest-addon#manual-setup
|
|
1185
|
+
https://storybook.js.org/docs/writing-tests/integrations/vitest-addon#manual-setup
|
|
1186
1186
|
`), errors.push(new AddonVitestPostinstallConfigUpdateError({ filePath: rootConfig }));
|
|
1187
1187
|
} else {
|
|
1188
1188
|
let parentDir = dirname(options.configDir), newConfigFile = resolve(parentDir, `vitest.config.${fileExtension}`), configTemplate = await loadTemplate(getTemplateName(), {
|
|
@@ -1217,7 +1217,7 @@ async function postInstall(options) {
|
|
|
1217
1217
|
logger.error(import_ts_dedent.dedent`
|
|
1218
1218
|
Could not automatically set up ${addonA11yName} for @storybook/addon-vitest.
|
|
1219
1219
|
Please refer to the documentation to complete the setup manually:
|
|
1220
|
-
https://storybook.js.org/docs/writing-tests/accessibility-testing#
|
|
1220
|
+
https://storybook.js.org/docs/writing-tests/accessibility-testing#test-addon-integration
|
|
1221
1221
|
`), errors.push(new AddonVitestPostinstallFailedAddonA11yError({ error: e }));
|
|
1222
1222
|
}
|
|
1223
1223
|
let runCommand = rootConfig ? "npx vitest --project=storybook" : "npx vitest";
|
|
@@ -1237,7 +1237,7 @@ async function postInstall(options) {
|
|
|
1237
1237
|
import_ts_dedent.dedent`
|
|
1238
1238
|
Done, but with errors!
|
|
1239
1239
|
@storybook/addon-vitest was installed successfully, but there were some errors during the setup process. Please refer to the documentation to complete the setup manually and check the errors above:
|
|
1240
|
-
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1240
|
+
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK}#manual-setup
|
|
1241
1241
|
`
|
|
1242
1242
|
), new AddonVitestPostinstallError({ errors });
|
|
1243
1243
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,10 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_rbsbl8boobn.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-KEOLLNOI.js";
|
|
16
16
|
import {
|
|
17
17
|
importMetaResolve
|
|
18
|
-
} from "./_node-chunks/chunk-
|
|
18
|
+
} from "./_node-chunks/chunk-5O7SAHGW.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID,
|
|
21
21
|
COVERAGE_DIRECTORY,
|
|
@@ -24,19 +24,19 @@ import {
|
|
|
24
24
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
25
25
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
26
26
|
storeOptions
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
27
|
+
} from "./_node-chunks/chunk-KZK5CHEO.js";
|
|
28
28
|
import {
|
|
29
29
|
require_picocolors
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-BSBLNKIU.js";
|
|
31
31
|
import {
|
|
32
32
|
require_dist
|
|
33
|
-
} from "./_node-chunks/chunk-
|
|
33
|
+
} from "./_node-chunks/chunk-XHOGP22F.js";
|
|
34
34
|
import {
|
|
35
35
|
normalize
|
|
36
|
-
} from "./_node-chunks/chunk-
|
|
36
|
+
} from "./_node-chunks/chunk-4TUFDYLN.js";
|
|
37
37
|
import {
|
|
38
38
|
__toESM
|
|
39
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-BUJNQJQC.js";
|
|
40
40
|
|
|
41
41
|
// src/preset.ts
|
|
42
42
|
import { mkdir } from "node:fs/promises";
|
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
loadPreviewOrConfigFile,
|
|
47
47
|
resolvePathInStorybookCache
|
|
48
48
|
} from "storybook/internal/common";
|
|
49
|
-
import { RUN_STORY_TESTS_REQUEST, RUN_STORY_TESTS_RESPONSE } from "storybook/internal/core-events";
|
|
50
49
|
import {
|
|
51
50
|
experimental_UniversalStore,
|
|
52
51
|
experimental_getTestProviderStore
|
|
@@ -265,7 +264,7 @@ var MAX_START_TIME = 3e4, vitestModulePath = fileURLToPath(importMetaResolve("@s
|
|
|
265
264
|
} else event.type === "uncaught-error" ? (store.send({
|
|
266
265
|
type: "FATAL_ERROR",
|
|
267
266
|
payload: event.payload
|
|
268
|
-
}), reject()) :
|
|
267
|
+
}), reject()) : channel.emit(event.type, ...event.args);
|
|
269
268
|
});
|
|
270
269
|
}), timeout = new Promise(
|
|
271
270
|
(_, reject) => setTimeout(
|
|
@@ -299,14 +298,7 @@ var MAX_START_TIME = 3e4, vitestModulePath = fileURLToPath(importMetaResolve("@s
|
|
|
299
298
|
options
|
|
300
299
|
}) => {
|
|
301
300
|
!ready && initEvent && eventQueue.push({ type: initEvent, args: initArgs }), child || (ready = !1, await bootTestRunner({ channel, store, options }), ready = !0);
|
|
302
|
-
}
|
|
303
|
-
let handleResult = (result) => {
|
|
304
|
-
channel.off("story-discovery-result", handleResult), channel.off("story-discovery-error", handleError), resolve(result);
|
|
305
|
-
}, handleError = (error) => {
|
|
306
|
-
channel.off("story-discovery-result", handleResult), channel.off("story-discovery-error", handleError), reject(new Error(error));
|
|
307
|
-
};
|
|
308
|
-
channel.on("story-discovery-result", handleResult), channel.on("story-discovery-error", handleError), child?.send({ type: "story-discovery-test-run", args: [storyIds], from: "server" });
|
|
309
|
-
}));
|
|
301
|
+
};
|
|
310
302
|
|
|
311
303
|
// src/preset.ts
|
|
312
304
|
var experimental_serverChannel = async (channel, options) => {
|
|
@@ -317,9 +309,9 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
317
309
|
), resolvedPreviewBuilder = typeof core?.builder == "string" ? core.builder : core?.builder?.name, framework = await getFrameworkName(options);
|
|
318
310
|
if (!resolvedPreviewBuilder?.includes("vite"))
|
|
319
311
|
return framework.includes("nextjs") && log(import_ts_dedent.dedent`
|
|
320
|
-
You're using ${framework}, which is a Webpack-based builder. In order to use Storybook
|
|
312
|
+
You're using ${framework}, which is a Webpack-based builder. In order to use Storybook Test, with your project, you need to use '@storybook/nextjs-vite', a high performance Vite-based equivalent.
|
|
321
313
|
|
|
322
|
-
|
|
314
|
+
Information on how to upgrade here: ${import_picocolors.default.yellow("https://storybook.js.org/docs/get-started/frameworks/nextjs?ref=upgrade#with-vite")}\n
|
|
323
315
|
`), channel;
|
|
324
316
|
let fsCache = createFileSystemCache({
|
|
325
317
|
basePath: resolvePathInStorybookCache(ADDON_ID.replace("/", "-")),
|
|
@@ -406,7 +398,7 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
406
398
|
});
|
|
407
399
|
}), store.subscribe("TEST_RUN_COMPLETED", async (event) => {
|
|
408
400
|
let { unhandledErrors, startedAt, finishedAt, ...currentRun } = event.payload;
|
|
409
|
-
|
|
401
|
+
await telemetry("addon-test", {
|
|
410
402
|
...currentRun,
|
|
411
403
|
duration: (finishedAt ?? 0) - (startedAt ?? 0),
|
|
412
404
|
unhandledErrorCount: unhandledErrors.length,
|
|
@@ -423,34 +415,6 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
423
415
|
});
|
|
424
416
|
});
|
|
425
417
|
}
|
|
426
|
-
channel.on("test-case-result", (result) => {
|
|
427
|
-
channel.emit("vitest-test-case-result", result);
|
|
428
|
-
}), channel.on(RUN_STORY_TESTS_REQUEST, async (data) => {
|
|
429
|
-
try {
|
|
430
|
-
let storyIds = data.payload.storyIds || [], requestId = data.id;
|
|
431
|
-
console.log("Running super real tests for story discovery:", storyIds);
|
|
432
|
-
let testRunResult = await runStoryDiscoveryTests(storyIds, channel, store, options);
|
|
433
|
-
console.log("Real test results:", testRunResult.testResults), console.log("Test summary:", testRunResult.testSummary), channel.emit(RUN_STORY_TESTS_RESPONSE, {
|
|
434
|
-
success: !0,
|
|
435
|
-
id: requestId,
|
|
436
|
-
payload: {
|
|
437
|
-
success: !0,
|
|
438
|
-
testResults: testRunResult.testResults,
|
|
439
|
-
testSummary: testRunResult.testSummary
|
|
440
|
-
},
|
|
441
|
-
error: null
|
|
442
|
-
});
|
|
443
|
-
} catch (error) {
|
|
444
|
-
console.error("Error in story discovery test execution:", error), channel.emit(RUN_STORY_TESTS_RESPONSE, {
|
|
445
|
-
success: !1,
|
|
446
|
-
id: data.id,
|
|
447
|
-
error: error.message || "Failed to run story tests"
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
function arraysEqual(a, b) {
|
|
452
|
-
return a.length !== b.length ? !1 : a.every((val, index) => val === b[index]);
|
|
453
|
-
}
|
|
454
418
|
return channel;
|
|
455
419
|
}, staticDirs = async (values = [], options) => {
|
|
456
420
|
if (options.configType === "PRODUCTION")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-BUJNQJQC.js";
|
|
17
17
|
|
|
18
18
|
// ../../../node_modules/tree-kill/index.js
|
|
19
19
|
var require_tree_kill = __commonJS({
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7dwglpfo06 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7dwglpfo06 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7dwglpfo06 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7dwglpfo06.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7dwglpfo06.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7dwglpfo06.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-BSBLNKIU.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-XHOGP22F.js";
|
|
18
18
|
import {
|
|
19
19
|
join,
|
|
20
20
|
normalize,
|
|
21
21
|
relative,
|
|
22
22
|
resolve,
|
|
23
23
|
sep
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-4TUFDYLN.js";
|
|
25
25
|
import {
|
|
26
26
|
__commonJS,
|
|
27
27
|
__require,
|
|
28
28
|
__toESM
|
|
29
|
-
} from "../_node-chunks/chunk-
|
|
29
|
+
} from "../_node-chunks/chunk-BUJNQJQC.js";
|
|
30
30
|
|
|
31
31
|
// ../../../node_modules/braces/lib/utils.js
|
|
32
32
|
var require_utils = __commonJS({
|
|
@@ -50,16 +50,7 @@ var DEFAULT_VIEWPORT_DIMENSIONS = {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
// src/vitest-plugin/test-utils.ts
|
|
53
|
-
var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.replace(/^file:\/\//, "").replace(/^\/+([a-zA-Z]:)/, "$1").replace(/%20/g, " "), testStory = ({
|
|
54
|
-
exportName,
|
|
55
|
-
story,
|
|
56
|
-
meta,
|
|
57
|
-
skipTags,
|
|
58
|
-
storyId,
|
|
59
|
-
componentPath,
|
|
60
|
-
testName,
|
|
61
|
-
componentName
|
|
62
|
-
}) => async (context) => {
|
|
53
|
+
var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.replace(/^file:\/\//, "").replace(/^\/+([a-zA-Z]:)/, "$1").replace(/%20/g, " "), testStory = (exportName, story, meta, skipTags, storyId, testName) => async (context) => {
|
|
63
54
|
let annotations = getCsfFactoryAnnotations(story, meta), test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0, storyAnnotations = test ? test.input : annotations.story, composedStory = composeStory(
|
|
64
55
|
storyAnnotations,
|
|
65
56
|
annotations.meta,
|
|
@@ -69,7 +60,7 @@ var { getInitialGlobals } = server.commands, convertToFilePath = (url) => url.re
|
|
|
69
60
|
);
|
|
70
61
|
(composedStory === void 0 || skipTags?.some((tag) => composedStory.tags.includes(tag))) && context.skip(), context.story = composedStory;
|
|
71
62
|
let _task = context.task;
|
|
72
|
-
_task.meta.storyId = storyId,
|
|
63
|
+
_task.meta.storyId = storyId, await setViewport(composedStory.parameters, composedStory.globals), await composedStory.run(void 0), _task.meta.reports = composedStory.reporting.reports;
|
|
73
64
|
};
|
|
74
65
|
export {
|
|
75
66
|
convertToFilePath,
|
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-33365-sha-d28e8fe8",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@vitest/browser-playwright": "^4.0.14",
|
|
80
80
|
"@vitest/runner": "^4.0.14",
|
|
81
81
|
"empathic": "^2.0.0",
|
|
82
|
-
"es-toolkit": "^1.
|
|
82
|
+
"es-toolkit": "^1.36.0",
|
|
83
83
|
"istanbul-lib-report": "^3.0.1",
|
|
84
84
|
"micromatch": "^4.0.8",
|
|
85
85
|
"pathe": "^1.1.2",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@vitest/browser": "^3.0.0 || ^4.0.0",
|
|
100
100
|
"@vitest/browser-playwright": "^4.0.0",
|
|
101
101
|
"@vitest/runner": "^3.0.0 || ^4.0.0",
|
|
102
|
-
"storybook": "^0.0.0-pr-
|
|
102
|
+
"storybook": "^0.0.0-pr-33365-sha-d28e8fe8",
|
|
103
103
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependenciesMeta": {
|