@storybook/addon-vitest 10.1.0-alpha.10 → 10.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/chunk-ULSHVN74.js +60 -0
- package/dist/_node-chunks/chunk-2CDZI4WP.js +339 -0
- package/dist/_node-chunks/chunk-3HJX4AQ5.js +1697 -0
- package/dist/_node-chunks/{chunk-7SKPZV4T.js → chunk-4R6Y7BGX.js} +11 -13
- package/dist/_node-chunks/chunk-5ZI5GUBS.js +83 -0
- package/dist/_node-chunks/chunk-AB3B3FVZ.js +69 -0
- package/dist/_node-chunks/chunk-IC274GVS.js +138 -0
- package/dist/_node-chunks/{chunk-7J6TCEGO.js → chunk-PCFYAAN7.js} +14 -19
- package/dist/_node-chunks/{chunk-U3WHYFEY.js → chunk-STKK7R3Q.js} +15 -24
- package/dist/index.js +1 -5
- package/dist/manager.js +163 -354
- package/dist/node/coverage-reporter.js +319 -864
- package/dist/node/vitest.js +189 -454
- package/dist/postinstall.js +476 -1343
- package/dist/preset.js +150 -338
- package/dist/vitest-plugin/global-setup.js +50 -105
- package/dist/vitest-plugin/index.js +1160 -2377
- package/dist/vitest-plugin/setup-file.js +6 -12
- package/dist/vitest-plugin/test-utils.js +31 -71
- package/package.json +3 -3
- package/dist/_browser-chunks/chunk-CAYLRBRX.js +0 -77
- package/dist/_browser-chunks/chunk-JK72E6FR.js +0 -6
- package/dist/_node-chunks/chunk-2GFDFSMJ.js +0 -98
- package/dist/_node-chunks/chunk-2VMVOZSQ.js +0 -247
- package/dist/_node-chunks/chunk-3G477K5F.js +0 -481
- package/dist/_node-chunks/chunk-ESR57AJV.js +0 -105
- package/dist/_node-chunks/chunk-VQBCAO3Q.js +0 -2574
package/dist/manager.js
CHANGED
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
10
10
|
TEST_PROVIDER_ID,
|
|
11
11
|
storeOptions
|
|
12
|
-
} from "./_browser-chunks/chunk-
|
|
13
|
-
import {
|
|
14
|
-
__name
|
|
15
|
-
} from "./_browser-chunks/chunk-JK72E6FR.js";
|
|
12
|
+
} from "./_browser-chunks/chunk-ULSHVN74.js";
|
|
16
13
|
|
|
17
14
|
// src/manager.tsx
|
|
18
15
|
import React5, { useState as useState3 } from "react";
|
|
@@ -27,10 +24,7 @@ import {
|
|
|
27
24
|
var store = experimental_UniversalStore.create({
|
|
28
25
|
...storeOptions,
|
|
29
26
|
leader: globalThis.CONFIG_TYPE === "PRODUCTION"
|
|
30
|
-
});
|
|
31
|
-
var componentTestStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST);
|
|
32
|
-
var a11yStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_A11Y);
|
|
33
|
-
var testProviderStore = experimental_getTestProviderStore(ADDON_ID2);
|
|
27
|
+
}), componentTestStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST), a11yStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_A11Y), testProviderStore = experimental_getTestProviderStore(ADDON_ID2);
|
|
34
28
|
|
|
35
29
|
// src/manager.tsx
|
|
36
30
|
import { addons as addons2 } from "storybook/manager-api";
|
|
@@ -46,58 +40,44 @@ var ModalBar = styled.div({
|
|
|
46
40
|
justifyContent: "space-between",
|
|
47
41
|
alignItems: "center",
|
|
48
42
|
padding: "6px 6px 6px 20px"
|
|
49
|
-
})
|
|
50
|
-
var ModalActionBar = styled.div({
|
|
43
|
+
}), ModalActionBar = styled.div({
|
|
51
44
|
display: "flex",
|
|
52
45
|
justifyContent: "space-between",
|
|
53
46
|
alignItems: "center"
|
|
54
|
-
})
|
|
55
|
-
var ModalTitle = styled(Modal.Title)(({ theme: { typography } }) => ({
|
|
47
|
+
}), ModalTitle = styled(Modal.Title)(({ theme: { typography } }) => ({
|
|
56
48
|
fontSize: typography.size.s2,
|
|
57
49
|
fontWeight: typography.weight.bold
|
|
58
|
-
}))
|
|
59
|
-
var ModalStackTrace = styled.pre(({ theme }) => ({
|
|
50
|
+
})), ModalStackTrace = styled.pre(({ theme }) => ({
|
|
60
51
|
whiteSpace: "pre-wrap",
|
|
61
52
|
wordWrap: "break-word",
|
|
62
53
|
overflow: "auto",
|
|
63
54
|
maxHeight: "60vh",
|
|
64
55
|
margin: 0,
|
|
65
|
-
padding:
|
|
56
|
+
padding: "20px",
|
|
66
57
|
fontFamily: theme.typography.fonts.mono,
|
|
67
58
|
fontSize: "12px",
|
|
68
59
|
borderTop: `1px solid ${theme.appBorderColor}`,
|
|
69
60
|
borderRadius: 0
|
|
70
|
-
}))
|
|
71
|
-
var TroubleshootLink = styled.a(({ theme }) => ({
|
|
61
|
+
})), TroubleshootLink = styled.a(({ theme }) => ({
|
|
72
62
|
color: theme.color.defaultText
|
|
73
|
-
}))
|
|
74
|
-
|
|
75
|
-
isModalOpen: false,
|
|
63
|
+
})), GlobalErrorContext = React.createContext({
|
|
64
|
+
isModalOpen: !1,
|
|
76
65
|
setModalOpen: void 0
|
|
77
66
|
});
|
|
78
67
|
function ErrorCause({ error }) {
|
|
79
|
-
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
return React.createElement("div", null, React.createElement("h4", null, "Caused by: ", error.name || "Error", ": ", error.message), error.stack && React.createElement("pre", null, error.stack), error.cause && React.createElement(ErrorCause, { error: error.cause }));
|
|
68
|
+
return error ? React.createElement("div", null, React.createElement("h4", null, "Caused by: ", error.name || "Error", ": ", error.message), error.stack && React.createElement("pre", null, error.stack), error.cause && React.createElement(ErrorCause, { error: error.cause })) : null;
|
|
83
69
|
}
|
|
84
|
-
__name(ErrorCause, "ErrorCause");
|
|
85
70
|
function GlobalErrorModal({ onRerun, storeState }) {
|
|
86
|
-
|
|
87
|
-
const { isModalOpen, setModalOpen } = useContext(GlobalErrorContext);
|
|
88
|
-
const troubleshootURL = api.getDocsUrl({
|
|
71
|
+
let api = useStorybookApi(), { isModalOpen, setModalOpen } = useContext(GlobalErrorContext), troubleshootURL = api.getDocsUrl({
|
|
89
72
|
subpath: DOCUMENTATION_FATAL_ERROR_LINK,
|
|
90
|
-
versioned:
|
|
91
|
-
renderer:
|
|
92
|
-
})
|
|
93
|
-
const {
|
|
73
|
+
versioned: !0,
|
|
74
|
+
renderer: !0
|
|
75
|
+
}), {
|
|
94
76
|
fatalError,
|
|
95
77
|
currentRun: { unhandledErrors }
|
|
96
|
-
} = storeState;
|
|
97
|
-
|
|
98
|
-
return React.createElement(Modal, { ariaLabel: "Storybook Tests error details", onOpenChange: setModalOpen, open: isModalOpen }, React.createElement(ModalBar, null, React.createElement(ModalTitle, null, "Storybook Tests error details"), React.createElement(ModalActionBar, null, React.createElement(Button, { onClick: onRerun, variant: "ghost", ariaLabel: false }, React.createElement(SyncIcon, null), "Rerun"), React.createElement(Button, { variant: "ghost", ariaLabel: false, asChild: true }, React.createElement("a", { target: "_blank", href: troubleshootURL, rel: "noreferrer" }, "Troubleshoot")), React.createElement(Modal.Close, null))), React.createElement(ModalStackTrace, null, content, React.createElement("br", null), React.createElement("br", null), "Troubleshoot:", " ", React.createElement(TroubleshootLink, { target: "_blank", href: troubleshootURL }, troubleshootURL)));
|
|
78
|
+
} = storeState, content = fatalError ? React.createElement(React.Fragment, null, React.createElement("p", null, fatalError.error.name || "Error"), fatalError.message && React.createElement("p", null, fatalError.message), fatalError.error.message && React.createElement("p", null, fatalError.error.message), fatalError.error.stack && React.createElement("p", null, fatalError.error.stack), fatalError.error.cause && React.createElement(ErrorCause, { error: fatalError.error.cause })) : unhandledErrors.length > 0 ? React.createElement("ol", null, unhandledErrors.map((error) => React.createElement("li", { key: error.name + error.message }, React.createElement("p", null, error.name, ": ", error.message), error.VITEST_TEST_PATH && React.createElement("p", null, 'This error originated in "', React.createElement("b", null, error.VITEST_TEST_PATH), `". It doesn't mean the error was thrown inside the file itself, but while it was running.`), error.VITEST_TEST_NAME && React.createElement(React.Fragment, null, React.createElement("p", null, `The latest test that might've caused the error is "`, React.createElement("b", null, error.VITEST_TEST_NAME), '". It might mean one of the following:'), React.createElement("ul", null, React.createElement("li", null, "The error was thrown, while Vitest was running this test."), React.createElement("li", null, "If the error occurred after the test had been completed, this was the last documented test before it was thrown."))), error.stacks && React.createElement(React.Fragment, null, React.createElement("p", null, React.createElement("b", null, "Stacks:")), React.createElement("ul", null, error.stacks.map((stack) => React.createElement("li", { key: stack.file + stack.line + stack.column }, stack.file, ":", stack.line, ":", stack.column, " - ", stack.method || "unknown method")))), error.stack && React.createElement("p", null, error.stack), error.cause ? React.createElement(ErrorCause, { error: error.cause }) : null))) : null;
|
|
79
|
+
return React.createElement(Modal, { ariaLabel: "Storybook Tests error details", onOpenChange: setModalOpen, open: isModalOpen }, React.createElement(ModalBar, null, React.createElement(ModalTitle, null, "Storybook Tests error details"), React.createElement(ModalActionBar, null, React.createElement(Button, { onClick: onRerun, variant: "ghost", ariaLabel: !1 }, React.createElement(SyncIcon, null), "Rerun"), React.createElement(Button, { variant: "ghost", ariaLabel: !1, asChild: !0 }, React.createElement("a", { target: "_blank", href: troubleshootURL, rel: "noreferrer" }, "Troubleshoot")), React.createElement(Modal.Close, null))), React.createElement(ModalStackTrace, null, content, React.createElement("br", null), React.createElement("br", null), "Troubleshoot:", " ", React.createElement(TroubleshootLink, { target: "_blank", href: troubleshootURL }, troubleshootURL)));
|
|
99
80
|
}
|
|
100
|
-
__name(GlobalErrorModal, "GlobalErrorModal");
|
|
101
81
|
|
|
102
82
|
// src/components/SidebarContextMenu.tsx
|
|
103
83
|
import React4 from "react";
|
|
@@ -107,172 +87,103 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
107
87
|
|
|
108
88
|
// ../../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
109
89
|
function isPlainObject(value) {
|
|
110
|
-
if (!value || typeof value
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const hasObjectPrototype = proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null;
|
|
115
|
-
if (!hasObjectPrototype) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
return Object.prototype.toString.call(value) === "[object Object]";
|
|
90
|
+
if (!value || typeof value != "object")
|
|
91
|
+
return !1;
|
|
92
|
+
let proto = Object.getPrototypeOf(value);
|
|
93
|
+
return proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null ? Object.prototype.toString.call(value) === "[object Object]" : !1;
|
|
119
94
|
}
|
|
120
|
-
__name(isPlainObject, "isPlainObject");
|
|
121
95
|
|
|
122
96
|
// ../../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
123
97
|
function getSymbols(object) {
|
|
124
98
|
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
125
99
|
}
|
|
126
|
-
__name(getSymbols, "getSymbols");
|
|
127
100
|
|
|
128
101
|
// ../../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
129
102
|
function getTag(value) {
|
|
130
|
-
|
|
131
|
-
return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
132
|
-
}
|
|
133
|
-
return Object.prototype.toString.call(value);
|
|
103
|
+
return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
|
|
134
104
|
}
|
|
135
|
-
__name(getTag, "getTag");
|
|
136
105
|
|
|
137
106
|
// ../../node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
138
|
-
var regexpTag = "[object RegExp]";
|
|
139
|
-
var stringTag = "[object String]";
|
|
140
|
-
var numberTag = "[object Number]";
|
|
141
|
-
var booleanTag = "[object Boolean]";
|
|
142
|
-
var argumentsTag = "[object Arguments]";
|
|
143
|
-
var symbolTag = "[object Symbol]";
|
|
144
|
-
var dateTag = "[object Date]";
|
|
145
|
-
var mapTag = "[object Map]";
|
|
146
|
-
var setTag = "[object Set]";
|
|
147
|
-
var arrayTag = "[object Array]";
|
|
148
|
-
var functionTag = "[object Function]";
|
|
149
|
-
var arrayBufferTag = "[object ArrayBuffer]";
|
|
150
|
-
var objectTag = "[object Object]";
|
|
151
|
-
var errorTag = "[object Error]";
|
|
152
|
-
var dataViewTag = "[object DataView]";
|
|
153
|
-
var uint8ArrayTag = "[object Uint8Array]";
|
|
154
|
-
var uint8ClampedArrayTag = "[object Uint8ClampedArray]";
|
|
155
|
-
var uint16ArrayTag = "[object Uint16Array]";
|
|
156
|
-
var uint32ArrayTag = "[object Uint32Array]";
|
|
157
|
-
var bigUint64ArrayTag = "[object BigUint64Array]";
|
|
158
|
-
var int8ArrayTag = "[object Int8Array]";
|
|
159
|
-
var int16ArrayTag = "[object Int16Array]";
|
|
160
|
-
var int32ArrayTag = "[object Int32Array]";
|
|
161
|
-
var bigInt64ArrayTag = "[object BigInt64Array]";
|
|
162
|
-
var float32ArrayTag = "[object Float32Array]";
|
|
163
|
-
var float64ArrayTag = "[object Float64Array]";
|
|
107
|
+
var regexpTag = "[object RegExp]", stringTag = "[object String]", numberTag = "[object Number]", booleanTag = "[object Boolean]", argumentsTag = "[object Arguments]", symbolTag = "[object Symbol]", dateTag = "[object Date]", mapTag = "[object Map]", setTag = "[object Set]", arrayTag = "[object Array]", functionTag = "[object Function]", arrayBufferTag = "[object ArrayBuffer]", objectTag = "[object Object]", errorTag = "[object Error]", dataViewTag = "[object DataView]", uint8ArrayTag = "[object Uint8Array]", uint8ClampedArrayTag = "[object Uint8ClampedArray]", uint16ArrayTag = "[object Uint16Array]", uint32ArrayTag = "[object Uint32Array]", bigUint64ArrayTag = "[object BigUint64Array]", int8ArrayTag = "[object Int8Array]", int16ArrayTag = "[object Int16Array]", int32ArrayTag = "[object Int32Array]", bigInt64ArrayTag = "[object BigInt64Array]", float32ArrayTag = "[object Float32Array]", float64ArrayTag = "[object Float64Array]";
|
|
164
108
|
|
|
165
109
|
// ../../node_modules/es-toolkit/dist/compat/util/eq.mjs
|
|
166
110
|
function eq(value, other) {
|
|
167
111
|
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
168
112
|
}
|
|
169
|
-
__name(eq, "eq");
|
|
170
113
|
|
|
171
114
|
// ../../node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
172
115
|
function isEqualWith(a, b, areValuesEqual) {
|
|
173
116
|
return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
|
|
174
117
|
}
|
|
175
|
-
__name(isEqualWith, "isEqualWith");
|
|
176
118
|
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
|
177
|
-
|
|
178
|
-
if (result !== void 0)
|
|
119
|
+
let result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
|
120
|
+
if (result !== void 0)
|
|
179
121
|
return result;
|
|
180
|
-
|
|
181
|
-
if (typeof a === typeof b) {
|
|
122
|
+
if (typeof a == typeof b)
|
|
182
123
|
switch (typeof a) {
|
|
183
124
|
case "bigint":
|
|
184
125
|
case "string":
|
|
185
126
|
case "boolean":
|
|
186
127
|
case "symbol":
|
|
187
|
-
case "undefined":
|
|
128
|
+
case "undefined":
|
|
188
129
|
return a === b;
|
|
189
|
-
|
|
190
|
-
case "number": {
|
|
130
|
+
case "number":
|
|
191
131
|
return a === b || Object.is(a, b);
|
|
192
|
-
|
|
193
|
-
case "function": {
|
|
132
|
+
case "function":
|
|
194
133
|
return a === b;
|
|
195
|
-
|
|
196
|
-
case "object": {
|
|
134
|
+
case "object":
|
|
197
135
|
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
198
|
-
}
|
|
199
136
|
}
|
|
200
|
-
}
|
|
201
137
|
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
202
138
|
}
|
|
203
|
-
__name(isEqualWithImpl, "isEqualWithImpl");
|
|
204
139
|
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
205
|
-
if (Object.is(a, b))
|
|
206
|
-
return
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (aTag === argumentsTag) {
|
|
211
|
-
aTag = objectTag;
|
|
212
|
-
}
|
|
213
|
-
if (bTag === argumentsTag) {
|
|
214
|
-
bTag = objectTag;
|
|
215
|
-
}
|
|
216
|
-
if (aTag !== bTag) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
140
|
+
if (Object.is(a, b))
|
|
141
|
+
return !0;
|
|
142
|
+
let aTag = getTag(a), bTag = getTag(b);
|
|
143
|
+
if (aTag === argumentsTag && (aTag = objectTag), bTag === argumentsTag && (bTag = objectTag), aTag !== bTag)
|
|
144
|
+
return !1;
|
|
219
145
|
switch (aTag) {
|
|
220
146
|
case stringTag:
|
|
221
147
|
return a.toString() === b.toString();
|
|
222
148
|
case numberTag: {
|
|
223
|
-
|
|
224
|
-
const y = b.valueOf();
|
|
149
|
+
let x = a.valueOf(), y = b.valueOf();
|
|
225
150
|
return eq(x, y);
|
|
226
151
|
}
|
|
227
152
|
case booleanTag:
|
|
228
153
|
case dateTag:
|
|
229
154
|
case symbolTag:
|
|
230
155
|
return Object.is(a.valueOf(), b.valueOf());
|
|
231
|
-
case regexpTag:
|
|
156
|
+
case regexpTag:
|
|
232
157
|
return a.source === b.source && a.flags === b.flags;
|
|
233
|
-
|
|
234
|
-
case functionTag: {
|
|
158
|
+
case functionTag:
|
|
235
159
|
return a === b;
|
|
236
|
-
}
|
|
237
160
|
}
|
|
238
161
|
stack = stack ?? /* @__PURE__ */ new Map();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (aStack != null && bStack != null) {
|
|
162
|
+
let aStack = stack.get(a), bStack = stack.get(b);
|
|
163
|
+
if (aStack != null && bStack != null)
|
|
242
164
|
return aStack === b;
|
|
243
|
-
|
|
244
|
-
stack.set(a, b);
|
|
245
|
-
stack.set(b, a);
|
|
165
|
+
stack.set(a, b), stack.set(b, a);
|
|
246
166
|
try {
|
|
247
167
|
switch (aTag) {
|
|
248
168
|
case mapTag: {
|
|
249
|
-
if (a.size !== b.size)
|
|
250
|
-
return
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return true;
|
|
169
|
+
if (a.size !== b.size)
|
|
170
|
+
return !1;
|
|
171
|
+
for (let [key, value] of a.entries())
|
|
172
|
+
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual))
|
|
173
|
+
return !1;
|
|
174
|
+
return !0;
|
|
258
175
|
}
|
|
259
176
|
case setTag: {
|
|
260
|
-
if (a.size !== b.size)
|
|
261
|
-
return
|
|
262
|
-
|
|
263
|
-
const aValues = Array.from(a.values());
|
|
264
|
-
const bValues = Array.from(b.values());
|
|
177
|
+
if (a.size !== b.size)
|
|
178
|
+
return !1;
|
|
179
|
+
let aValues = Array.from(a.values()), bValues = Array.from(b.values());
|
|
265
180
|
for (let i = 0; i < aValues.length; i++) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
return
|
|
269
|
-
});
|
|
270
|
-
if (index === -1) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
181
|
+
let aValue = aValues[i], index = bValues.findIndex((bValue) => isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual));
|
|
182
|
+
if (index === -1)
|
|
183
|
+
return !1;
|
|
273
184
|
bValues.splice(index, 1);
|
|
274
185
|
}
|
|
275
|
-
return
|
|
186
|
+
return !0;
|
|
276
187
|
}
|
|
277
188
|
case arrayTag:
|
|
278
189
|
case uint8ArrayTag:
|
|
@@ -286,78 +197,51 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
286
197
|
case bigInt64ArrayTag:
|
|
287
198
|
case float32ArrayTag:
|
|
288
199
|
case float64ArrayTag: {
|
|
289
|
-
if (typeof Buffer
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
for (let i = 0; i < a.length; i++) {
|
|
296
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
case arrayBufferTag: {
|
|
303
|
-
if (a.byteLength !== b.byteLength) {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
307
|
-
}
|
|
308
|
-
case dataViewTag: {
|
|
309
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
200
|
+
if (typeof Buffer < "u" && Buffer.isBuffer(a) !== Buffer.isBuffer(b) || a.length !== b.length)
|
|
201
|
+
return !1;
|
|
202
|
+
for (let i = 0; i < a.length; i++)
|
|
203
|
+
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual))
|
|
204
|
+
return !1;
|
|
205
|
+
return !0;
|
|
313
206
|
}
|
|
314
|
-
case
|
|
207
|
+
case arrayBufferTag:
|
|
208
|
+
return a.byteLength !== b.byteLength ? !1 : areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
209
|
+
case dataViewTag:
|
|
210
|
+
return a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset ? !1 : areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
211
|
+
case errorTag:
|
|
315
212
|
return a.name === b.name && a.message === b.message;
|
|
316
|
-
}
|
|
317
213
|
case objectTag: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
324
|
-
if (aKeys.length !== bKeys.length) {
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
214
|
+
if (!(areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b)))
|
|
215
|
+
return !1;
|
|
216
|
+
let aKeys = [...Object.keys(a), ...getSymbols(a)], bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
217
|
+
if (aKeys.length !== bKeys.length)
|
|
218
|
+
return !1;
|
|
327
219
|
for (let i = 0; i < aKeys.length; i++) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
|
335
|
-
return false;
|
|
336
|
-
}
|
|
220
|
+
let propKey = aKeys[i], aProp = a[propKey];
|
|
221
|
+
if (!Object.hasOwn(b, propKey))
|
|
222
|
+
return !1;
|
|
223
|
+
let bProp = b[propKey];
|
|
224
|
+
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual))
|
|
225
|
+
return !1;
|
|
337
226
|
}
|
|
338
|
-
return
|
|
339
|
-
}
|
|
340
|
-
default: {
|
|
341
|
-
return false;
|
|
227
|
+
return !0;
|
|
342
228
|
}
|
|
229
|
+
default:
|
|
230
|
+
return !1;
|
|
343
231
|
}
|
|
344
232
|
} finally {
|
|
345
|
-
stack.delete(a);
|
|
346
|
-
stack.delete(b);
|
|
233
|
+
stack.delete(a), stack.delete(b);
|
|
347
234
|
}
|
|
348
235
|
}
|
|
349
|
-
__name(areObjectsEqual, "areObjectsEqual");
|
|
350
236
|
|
|
351
237
|
// ../../node_modules/es-toolkit/dist/function/noop.mjs
|
|
352
238
|
function noop() {
|
|
353
239
|
}
|
|
354
|
-
__name(noop, "noop");
|
|
355
240
|
|
|
356
241
|
// ../../node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
357
242
|
function isEqual(a, b) {
|
|
358
243
|
return isEqualWith(a, b, noop);
|
|
359
244
|
}
|
|
360
|
-
__name(isEqual, "isEqual");
|
|
361
245
|
|
|
362
246
|
// src/use-test-provider-state.ts
|
|
363
247
|
import {
|
|
@@ -365,61 +249,42 @@ import {
|
|
|
365
249
|
experimental_useTestProviderStore,
|
|
366
250
|
experimental_useUniversalStore
|
|
367
251
|
} from "storybook/manager-api";
|
|
368
|
-
var statusValueToStoryIds =
|
|
369
|
-
|
|
252
|
+
var statusValueToStoryIds = (allStatuses, typeId, storyIds) => {
|
|
253
|
+
let statusValueToStoryIdsMap = {
|
|
370
254
|
"status-value:pending": [],
|
|
371
255
|
"status-value:success": [],
|
|
372
256
|
"status-value:error": [],
|
|
373
257
|
"status-value:warning": [],
|
|
374
258
|
"status-value:unknown": []
|
|
375
259
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
statusValueToStoryIdsMap[status.value].push(status.storyId);
|
|
383
|
-
});
|
|
384
|
-
return statusValueToStoryIdsMap;
|
|
385
|
-
}, "statusValueToStoryIds");
|
|
386
|
-
var useTestProvider = /* @__PURE__ */ __name((api, entryId) => {
|
|
387
|
-
const testProviderState = experimental_useTestProviderStore((s) => s[ADDON_ID2]);
|
|
388
|
-
const [storeState, setStoreState] = experimental_useUniversalStore(store);
|
|
389
|
-
const [isSettingsUpdated, setIsSettingsUpdated] = useState(false);
|
|
390
|
-
const settingsUpdatedTimeoutRef = useRef();
|
|
260
|
+
return (storyIds ? storyIds.map((storyId) => allStatuses[storyId]).filter(Boolean) : Object.values(allStatuses)).forEach((statusByTypeId) => {
|
|
261
|
+
let status = statusByTypeId[typeId];
|
|
262
|
+
status && statusValueToStoryIdsMap[status.value].push(status.storyId);
|
|
263
|
+
}), statusValueToStoryIdsMap;
|
|
264
|
+
}, useTestProvider = (api, entryId) => {
|
|
265
|
+
let testProviderState = experimental_useTestProviderStore((s) => s[ADDON_ID2]), [storeState, setStoreState] = experimental_useUniversalStore(store), [isSettingsUpdated, setIsSettingsUpdated] = useState(!1), settingsUpdatedTimeoutRef = useRef();
|
|
391
266
|
useEffect(() => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
clearTimeout(settingsUpdatedTimeoutRef.current);
|
|
397
|
-
settingsUpdatedTimeoutRef.current = setTimeout(() => {
|
|
398
|
-
setIsSettingsUpdated(false);
|
|
399
|
-
}, 1e3);
|
|
400
|
-
}
|
|
267
|
+
let unsubscribe = store.onStateChange((state, previousState) => {
|
|
268
|
+
isEqual(state.config, previousState.config) || (testProviderStore.settingsChanged(), setIsSettingsUpdated(!0), clearTimeout(settingsUpdatedTimeoutRef.current), settingsUpdatedTimeoutRef.current = setTimeout(() => {
|
|
269
|
+
setIsSettingsUpdated(!1);
|
|
270
|
+
}, 1e3));
|
|
401
271
|
});
|
|
402
272
|
return () => {
|
|
403
|
-
unsubscribe();
|
|
404
|
-
clearTimeout(settingsUpdatedTimeoutRef.current);
|
|
273
|
+
unsubscribe(), clearTimeout(settingsUpdatedTimeoutRef.current);
|
|
405
274
|
};
|
|
406
275
|
}, []);
|
|
407
|
-
|
|
276
|
+
let storyIds = useMemo(
|
|
408
277
|
() => entryId ? api.findAllLeafStoryIds(entryId) : void 0,
|
|
409
278
|
[entryId, api]
|
|
410
|
-
)
|
|
411
|
-
const componentTestStatusSelector = useCallback(
|
|
279
|
+
), componentTestStatusSelector = useCallback(
|
|
412
280
|
(allStatuses) => statusValueToStoryIds(allStatuses, STATUS_TYPE_ID_COMPONENT_TEST, storyIds),
|
|
413
281
|
[storyIds]
|
|
414
|
-
)
|
|
415
|
-
const componentTestStatusValueToStoryIds = experimental_useStatusStore(
|
|
282
|
+
), componentTestStatusValueToStoryIds = experimental_useStatusStore(
|
|
416
283
|
componentTestStatusSelector
|
|
417
|
-
)
|
|
418
|
-
const a11yStatusValueToStoryIdsSelector = useCallback(
|
|
284
|
+
), a11yStatusValueToStoryIdsSelector = useCallback(
|
|
419
285
|
(allStatuses) => statusValueToStoryIds(allStatuses, STATUS_TYPE_ID_A11Y, storyIds),
|
|
420
286
|
[storyIds]
|
|
421
|
-
);
|
|
422
|
-
const a11yStatusValueToStoryIds = experimental_useStatusStore(a11yStatusValueToStoryIdsSelector);
|
|
287
|
+
), a11yStatusValueToStoryIds = experimental_useStatusStore(a11yStatusValueToStoryIdsSelector);
|
|
423
288
|
return {
|
|
424
289
|
storeState,
|
|
425
290
|
setStoreState,
|
|
@@ -428,7 +293,7 @@ var useTestProvider = /* @__PURE__ */ __name((api, entryId) => {
|
|
|
428
293
|
a11yStatusValueToStoryIds,
|
|
429
294
|
isSettingsUpdated
|
|
430
295
|
};
|
|
431
|
-
}
|
|
296
|
+
};
|
|
432
297
|
|
|
433
298
|
// src/components/TestProviderRender.tsx
|
|
434
299
|
import React3 from "react";
|
|
@@ -450,33 +315,28 @@ import { styled as styled2 } from "storybook/theming";
|
|
|
450
315
|
|
|
451
316
|
// src/components/RelativeTime.tsx
|
|
452
317
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
453
|
-
var RelativeTime =
|
|
454
|
-
|
|
455
|
-
useEffect2(() => {
|
|
318
|
+
var RelativeTime = ({ timestamp }) => {
|
|
319
|
+
let [timeAgo, setTimeAgo] = useState2(null);
|
|
320
|
+
if (useEffect2(() => {
|
|
456
321
|
if (timestamp) {
|
|
457
322
|
setTimeAgo(Date.now() - timestamp);
|
|
458
|
-
|
|
323
|
+
let interval = setInterval(() => setTimeAgo(Date.now() - timestamp), 1e4);
|
|
459
324
|
return () => clearInterval(interval);
|
|
460
325
|
}
|
|
461
|
-
}, [timestamp])
|
|
462
|
-
if (timeAgo === null) {
|
|
326
|
+
}, [timestamp]), timeAgo === null)
|
|
463
327
|
return null;
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
const days = Math.floor(hours / 24);
|
|
478
|
-
return days === 1 ? `yesterday` : `${days} days ago`;
|
|
479
|
-
}, "RelativeTime");
|
|
328
|
+
let seconds = Math.round(timeAgo / 1e3);
|
|
329
|
+
if (seconds < 60)
|
|
330
|
+
return "just now";
|
|
331
|
+
let minutes = Math.floor(seconds / 60);
|
|
332
|
+
if (minutes < 60)
|
|
333
|
+
return minutes === 1 ? "a minute ago" : `${minutes} minutes ago`;
|
|
334
|
+
let hours = Math.floor(minutes / 60);
|
|
335
|
+
if (hours < 24)
|
|
336
|
+
return hours === 1 ? "an hour ago" : `${hours} hours ago`;
|
|
337
|
+
let days = Math.floor(hours / 24);
|
|
338
|
+
return days === 1 ? "yesterday" : `${days} days ago`;
|
|
339
|
+
};
|
|
480
340
|
|
|
481
341
|
// src/components/Description.tsx
|
|
482
342
|
var Wrapper = styled2.div(({ theme }) => ({
|
|
@@ -485,8 +345,7 @@ var Wrapper = styled2.div(({ theme }) => ({
|
|
|
485
345
|
textOverflow: "ellipsis",
|
|
486
346
|
fontSize: theme.typography.size.s1,
|
|
487
347
|
color: theme.textMutedColor
|
|
488
|
-
}))
|
|
489
|
-
var PositiveText = styled2.span(({ theme }) => ({
|
|
348
|
+
})), PositiveText = styled2.span(({ theme }) => ({
|
|
490
349
|
color: theme.color.positiveText
|
|
491
350
|
}));
|
|
492
351
|
function Description({
|
|
@@ -496,29 +355,19 @@ function Description({
|
|
|
496
355
|
isSettingsUpdated,
|
|
497
356
|
...props
|
|
498
357
|
}) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
const finishedTestCount = componentTestCount.success + componentTestCount.error;
|
|
502
|
-
let description = "Not run";
|
|
503
|
-
if (!entryId && isSettingsUpdated) {
|
|
358
|
+
let { setModalOpen } = React2.useContext(GlobalErrorContext), { componentTestCount, totalTestCount, unhandledErrors, finishedAt } = storeState.currentRun, finishedTestCount = componentTestCount.success + componentTestCount.error, description = "Not run";
|
|
359
|
+
if (!entryId && isSettingsUpdated)
|
|
504
360
|
description = React2.createElement(PositiveText, null, "Settings updated");
|
|
505
|
-
|
|
361
|
+
else if (testProviderState === "test-provider-state:running")
|
|
506
362
|
description = (finishedTestCount ?? 0) === 0 ? "Starting..." : `Testing... ${finishedTestCount}/${totalTestCount}`;
|
|
507
|
-
|
|
508
|
-
description = setModalOpen ? React2.createElement(LinkComponent, { isButton:
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
description = setModalOpen ? React2.createElement(LinkComponent, { isButton:
|
|
512
|
-
} else
|
|
513
|
-
description = `Ran ${totalTestCount} ${totalTestCount === 1 ? "test" : "tests"}`;
|
|
514
|
-
} else if (finishedAt) {
|
|
515
|
-
description = React2.createElement(React2.Fragment, null, "Ran ", totalTestCount, " ", totalTestCount === 1 ? "test" : "tests", " ", React2.createElement(RelativeTime, { timestamp: finishedAt }));
|
|
516
|
-
} else if (storeState.watching) {
|
|
517
|
-
description = "Watching for file changes";
|
|
518
|
-
}
|
|
363
|
+
else if (!entryId && testProviderState === "test-provider-state:crashed")
|
|
364
|
+
description = setModalOpen ? React2.createElement(LinkComponent, { isButton: !0, onClick: () => setModalOpen(!0) }, "View full error") : "Crashed";
|
|
365
|
+
else if (!entryId && unhandledErrors.length > 0) {
|
|
366
|
+
let unhandledErrorDescription = `View ${unhandledErrors.length} unhandled error${unhandledErrors?.length > 1 ? "s" : ""}`;
|
|
367
|
+
description = setModalOpen ? React2.createElement(LinkComponent, { isButton: !0, onClick: () => setModalOpen(!0) }, unhandledErrorDescription) : unhandledErrorDescription;
|
|
368
|
+
} else entryId && totalTestCount ? description = `Ran ${totalTestCount} ${totalTestCount === 1 ? "test" : "tests"}` : finishedAt ? description = React2.createElement(React2.Fragment, null, "Ran ", totalTestCount, " ", totalTestCount === 1 ? "test" : "tests", " ", React2.createElement(RelativeTime, { timestamp: finishedAt })) : storeState.watching && (description = "Watching for file changes");
|
|
519
369
|
return React2.createElement(Wrapper, { ...props }, description);
|
|
520
370
|
}
|
|
521
|
-
__name(Description, "Description");
|
|
522
371
|
|
|
523
372
|
// src/components/TestStatusIcon.tsx
|
|
524
373
|
import { styled as styled3 } from "storybook/theming";
|
|
@@ -559,53 +408,38 @@ var TestStatusIcon = styled3.div(
|
|
|
559
408
|
var Container = styled4.div({
|
|
560
409
|
display: "flex",
|
|
561
410
|
flexDirection: "column"
|
|
562
|
-
})
|
|
563
|
-
var Heading = styled4.div({
|
|
411
|
+
}), Heading = styled4.div({
|
|
564
412
|
display: "flex",
|
|
565
413
|
justifyContent: "space-between",
|
|
566
414
|
padding: "8px 0",
|
|
567
415
|
gap: 12
|
|
568
|
-
})
|
|
569
|
-
var Info = styled4.div({
|
|
416
|
+
}), Info = styled4.div({
|
|
570
417
|
display: "flex",
|
|
571
418
|
flexDirection: "column",
|
|
572
419
|
marginLeft: 8,
|
|
573
420
|
minWidth: 0
|
|
574
|
-
})
|
|
575
|
-
var Title = styled4.div(({ crashed, theme }) => ({
|
|
421
|
+
}), Title = styled4.div(({ crashed, theme }) => ({
|
|
576
422
|
fontSize: theme.typography.size.s1,
|
|
577
423
|
fontWeight: crashed ? "bold" : "normal",
|
|
578
424
|
color: crashed ? theme.color.negativeText : theme.color.defaultText
|
|
579
|
-
}))
|
|
580
|
-
var Actions = styled4.div({
|
|
425
|
+
})), Actions = styled4.div({
|
|
581
426
|
display: "flex",
|
|
582
427
|
gap: 4
|
|
583
|
-
})
|
|
584
|
-
var Extras = styled4.div({
|
|
428
|
+
}), Extras = styled4.div({
|
|
585
429
|
marginBottom: 2
|
|
586
|
-
})
|
|
587
|
-
var Muted = styled4.span(({ theme }) => ({
|
|
430
|
+
}), Muted = styled4.span(({ theme }) => ({
|
|
588
431
|
color: theme.textMutedColor
|
|
589
|
-
}))
|
|
590
|
-
var Progress = styled4(ProgressSpinner)({
|
|
432
|
+
})), Progress = styled4(ProgressSpinner)({
|
|
591
433
|
margin: 4
|
|
592
|
-
})
|
|
593
|
-
var Row = styled4.div({
|
|
434
|
+
}), Row = styled4.div({
|
|
594
435
|
display: "flex",
|
|
595
436
|
gap: 4
|
|
596
|
-
})
|
|
597
|
-
var StopIcon = styled4(StopAltIcon)({
|
|
437
|
+
}), StopIcon = styled4(StopAltIcon)({
|
|
598
438
|
width: 10
|
|
599
|
-
})
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
api.selectStory(story);
|
|
604
|
-
}
|
|
605
|
-
api.setSelectedPanel(panelId);
|
|
606
|
-
api.togglePanel(true);
|
|
607
|
-
}, "openPanel");
|
|
608
|
-
var TestProviderRender = /* @__PURE__ */ __name(({
|
|
439
|
+
}), openPanel = ({ api, panelId, entryId }) => {
|
|
440
|
+
let story = entryId ? api.findAllLeafStoryIds(entryId)[0] : void 0;
|
|
441
|
+
story && api.selectStory(story), api.setSelectedPanel(panelId), api.togglePanel(!0);
|
|
442
|
+
}, TestProviderRender = ({
|
|
609
443
|
api,
|
|
610
444
|
entry,
|
|
611
445
|
testProviderState,
|
|
@@ -616,13 +450,7 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
616
450
|
isSettingsUpdated,
|
|
617
451
|
...props
|
|
618
452
|
}) => {
|
|
619
|
-
|
|
620
|
-
const finishedTestCount = currentRun.componentTestCount.success + currentRun.componentTestCount.error;
|
|
621
|
-
const hasA11yAddon = addons.experimental_getRegisteredAddons().includes(ADDON_ID);
|
|
622
|
-
const isRunning = testProviderState === "test-provider-state:running";
|
|
623
|
-
const isStarting = isRunning && finishedTestCount === 0;
|
|
624
|
-
const [componentTestStatusIcon, componentTestStatusLabel] = fatalError ? ["critical", "Component tests crashed"] : componentTestStatusValueToStoryIds["status-value:error"].length > 0 ? ["negative", "Component tests failed"] : isRunning ? ["unknown", "Testing in progress"] : componentTestStatusValueToStoryIds["status-value:success"].length > 0 ? ["positive", "Component tests passed"] : ["unknown", "Run tests to see results"];
|
|
625
|
-
const [a11yStatusIcon, a11yStatusLabel] = fatalError ? ["critical", "Component tests crashed"] : a11yStatusValueToStoryIds["status-value:error"].length > 0 ? ["negative", "Accessibility tests failed"] : a11yStatusValueToStoryIds["status-value:warning"].length > 0 ? ["warning", "Accessibility tests failed"] : isRunning ? ["unknown", "Testing in progress"] : a11yStatusValueToStoryIds["status-value:success"].length > 0 ? ["positive", "Accessibility tests passed"] : ["unknown", "Run tests to see accessibility results"];
|
|
453
|
+
let { config, watching, cancelling, currentRun, fatalError } = storeState, finishedTestCount = currentRun.componentTestCount.success + currentRun.componentTestCount.error, hasA11yAddon = addons.experimental_getRegisteredAddons().includes(ADDON_ID), isRunning = testProviderState === "test-provider-state:running", isStarting = isRunning && finishedTestCount === 0, [componentTestStatusIcon, componentTestStatusLabel] = fatalError ? ["critical", "Component tests crashed"] : componentTestStatusValueToStoryIds["status-value:error"].length > 0 ? ["negative", "Component tests failed"] : isRunning ? ["unknown", "Testing in progress"] : componentTestStatusValueToStoryIds["status-value:success"].length > 0 ? ["positive", "Component tests passed"] : ["unknown", "Run tests to see results"], [a11yStatusIcon, a11yStatusLabel] = fatalError ? ["critical", "Component tests crashed"] : a11yStatusValueToStoryIds["status-value:error"].length > 0 ? ["negative", "Accessibility tests failed"] : a11yStatusValueToStoryIds["status-value:warning"].length > 0 ? ["warning", "Accessibility tests failed"] : isRunning ? ["unknown", "Testing in progress"] : a11yStatusValueToStoryIds["status-value:success"].length > 0 ? ["positive", "Accessibility tests passed"] : ["unknown", "Run tests to see accessibility results"];
|
|
626
454
|
return React3.createElement(Container, { ...props }, React3.createElement(Heading, null, React3.createElement(Info, null, entry ? React3.createElement(Title, { id: "testing-module-title" }, "Run component tests") : React3.createElement(
|
|
627
455
|
Title,
|
|
628
456
|
{
|
|
@@ -685,10 +513,7 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
685
513
|
variant: "ghost",
|
|
686
514
|
onClick: () => {
|
|
687
515
|
let storyIds;
|
|
688
|
-
|
|
689
|
-
storyIds = entry.type === "story" ? [entry.id] : api.findAllLeafStoryIds(entry.id);
|
|
690
|
-
}
|
|
691
|
-
store.send({
|
|
516
|
+
entry && (storyIds = entry.type === "story" ? [entry.id] : api.findAllLeafStoryIds(entry.id)), store.send({
|
|
692
517
|
type: "TRIGGER_RUN",
|
|
693
518
|
payload: { storyIds, triggeredBy: entry?.type ?? "global" }
|
|
694
519
|
});
|
|
@@ -700,7 +525,7 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
700
525
|
{
|
|
701
526
|
as: "label",
|
|
702
527
|
title: "Interactions",
|
|
703
|
-
icon: entry ? null : React3.createElement(Form.Checkbox, { checked:
|
|
528
|
+
icon: entry ? null : React3.createElement(Form.Checkbox, { checked: !0, disabled: !0 })
|
|
704
529
|
}
|
|
705
530
|
), React3.createElement(
|
|
706
531
|
Button2,
|
|
@@ -744,14 +569,14 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
744
569
|
padding: "small",
|
|
745
570
|
size: "medium",
|
|
746
571
|
variant: "ghost",
|
|
747
|
-
disabled:
|
|
748
|
-
ariaLabel: watching ?
|
|
572
|
+
disabled: !0,
|
|
573
|
+
ariaLabel: watching ? "Coverage unavailable in watch mode" : "Coverage unavailable when running focused tests"
|
|
749
574
|
},
|
|
750
575
|
React3.createElement(InfoIcon, null)
|
|
751
576
|
) : currentRun.coverageSummary ? React3.createElement(
|
|
752
577
|
Button2,
|
|
753
578
|
{
|
|
754
|
-
asChild:
|
|
579
|
+
asChild: !0,
|
|
755
580
|
padding: "small",
|
|
756
581
|
size: "medium",
|
|
757
582
|
variant: "ghost",
|
|
@@ -775,7 +600,7 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
775
600
|
padding: "small",
|
|
776
601
|
size: "medium",
|
|
777
602
|
variant: "ghost",
|
|
778
|
-
disabled:
|
|
603
|
+
disabled: !0,
|
|
779
604
|
ariaLabel: isRunning ? "Coverage unavailable, testing still in progress" : fatalError ? "Coverage unavailable, component tests crashed" : "Coverage unavailable, run tests first"
|
|
780
605
|
},
|
|
781
606
|
React3.createElement(
|
|
@@ -821,11 +646,11 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
821
646
|
React3.createElement(TestStatusIcon, { status: a11yStatusIcon, isRunning }),
|
|
822
647
|
a11yStatusValueToStoryIds["status-value:error"].length + a11yStatusValueToStoryIds["status-value:warning"].length || null
|
|
823
648
|
))));
|
|
824
|
-
}
|
|
649
|
+
};
|
|
825
650
|
|
|
826
651
|
// src/components/SidebarContextMenu.tsx
|
|
827
|
-
var SidebarContextMenu =
|
|
828
|
-
|
|
652
|
+
var SidebarContextMenu = ({ context, api }) => {
|
|
653
|
+
let {
|
|
829
654
|
testProviderState,
|
|
830
655
|
componentTestStatusValueToStoryIds,
|
|
831
656
|
a11yStatusValueToStoryIds,
|
|
@@ -843,44 +668,37 @@ var SidebarContextMenu = /* @__PURE__ */ __name(({ context, api }) => {
|
|
|
843
668
|
a11yStatusValueToStoryIds,
|
|
844
669
|
storeState,
|
|
845
670
|
setStoreState,
|
|
846
|
-
isSettingsUpdated:
|
|
671
|
+
isSettingsUpdated: !1
|
|
847
672
|
}
|
|
848
673
|
);
|
|
849
|
-
}
|
|
674
|
+
};
|
|
850
675
|
|
|
851
676
|
// src/manager.tsx
|
|
852
677
|
addons2.register(ADDON_ID2, (api) => {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
api.togglePanel(true);
|
|
858
|
-
}, "openPanel");
|
|
678
|
+
if ((globalThis.STORYBOOK_BUILDER || "").includes("vite")) {
|
|
679
|
+
let openPanel2 = (panelId) => {
|
|
680
|
+
api.setSelectedPanel(panelId), api.togglePanel(!0);
|
|
681
|
+
};
|
|
859
682
|
componentTestStatusStore.onSelect(() => {
|
|
860
683
|
openPanel2(PANEL_ID);
|
|
861
|
-
})
|
|
862
|
-
a11yStatusStore.onSelect(() => {
|
|
684
|
+
}), a11yStatusStore.onSelect(() => {
|
|
863
685
|
openPanel2(PANEL_ID2);
|
|
864
|
-
})
|
|
865
|
-
testProviderStore.onRunAll(() => {
|
|
686
|
+
}), testProviderStore.onRunAll(() => {
|
|
866
687
|
store.send({
|
|
867
688
|
type: "TRIGGER_RUN",
|
|
868
689
|
payload: {
|
|
869
690
|
triggeredBy: "run-all"
|
|
870
691
|
}
|
|
871
692
|
});
|
|
872
|
-
})
|
|
873
|
-
store.untilReady().then(() => {
|
|
693
|
+
}), store.untilReady().then(() => {
|
|
874
694
|
store.setState((state) => ({
|
|
875
695
|
...state,
|
|
876
696
|
indexUrl: new URL("index.json", window.location.href).toString()
|
|
877
697
|
}));
|
|
878
|
-
})
|
|
879
|
-
addons2.add(TEST_PROVIDER_ID, {
|
|
698
|
+
}), addons2.add(TEST_PROVIDER_ID, {
|
|
880
699
|
type: Addon_TypesEnum.experimental_TEST_PROVIDER,
|
|
881
|
-
render:
|
|
882
|
-
|
|
883
|
-
const {
|
|
700
|
+
render: () => {
|
|
701
|
+
let [isModalOpen, setModalOpen] = useState3(!1), {
|
|
884
702
|
storeState,
|
|
885
703
|
setStoreState,
|
|
886
704
|
testProviderState,
|
|
@@ -904,8 +722,7 @@ addons2.register(ADDON_ID2, (api) => {
|
|
|
904
722
|
{
|
|
905
723
|
storeState,
|
|
906
724
|
onRerun: () => {
|
|
907
|
-
setModalOpen(
|
|
908
|
-
store.send({
|
|
725
|
+
setModalOpen(!1), store.send({
|
|
909
726
|
type: "TRIGGER_RUN",
|
|
910
727
|
payload: {
|
|
911
728
|
triggeredBy: "global"
|
|
@@ -914,16 +731,8 @@ addons2.register(ADDON_ID2, (api) => {
|
|
|
914
731
|
}
|
|
915
732
|
}
|
|
916
733
|
));
|
|
917
|
-
},
|
|
918
|
-
sidebarContextMenu:
|
|
919
|
-
if (context.type === "docs") {
|
|
920
|
-
return null;
|
|
921
|
-
}
|
|
922
|
-
if (context.type === "story" && !context.tags.includes("test")) {
|
|
923
|
-
return null;
|
|
924
|
-
}
|
|
925
|
-
return React5.createElement(SidebarContextMenu, { context, api });
|
|
926
|
-
}, "sidebarContextMenu")
|
|
734
|
+
},
|
|
735
|
+
sidebarContextMenu: ({ context }) => context.type === "docs" || context.type === "story" && !context.tags.includes("test") ? null : React5.createElement(SidebarContextMenu, { context, api })
|
|
927
736
|
});
|
|
928
737
|
}
|
|
929
738
|
});
|