storybook 10.2.0-alpha.17 → 10.2.0-alpha.18
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/{builder-manager-Q4F5VX5J.js → builder-manager-RC5VXLE2.js} +12 -12
- package/dist/_node-chunks/{camelcase-FL6OBJRZ.js → camelcase-3YERF6B7.js} +7 -7
- package/dist/_node-chunks/chunk-2H33L3XJ.js +61 -0
- package/dist/_node-chunks/{chunk-JBRILZWU.js → chunk-2M7TBZBZ.js} +6 -6
- package/dist/_node-chunks/{chunk-XYONORVT.js → chunk-4HG57EIN.js} +7 -7
- package/dist/_node-chunks/{chunk-IWM3WHZE.js → chunk-4PWGJYBL.js} +7 -7
- package/dist/_node-chunks/{chunk-FAARRTOD.js → chunk-54FLVGBQ.js} +6 -6
- package/dist/_node-chunks/{chunk-25OWI2RR.js → chunk-5BYTBW23.js} +6 -6
- package/dist/_node-chunks/{chunk-EYPTVKFI.js → chunk-5QNVOHBZ.js} +15 -14
- package/dist/_node-chunks/{chunk-KKNWPXMS.js → chunk-6TOW3ZMZ.js} +6 -6
- package/dist/_node-chunks/{chunk-XI7HDOMY.js → chunk-A2364FS2.js} +7 -7
- package/dist/_node-chunks/{chunk-2XSHQN7K.js → chunk-BWA66NDS.js} +10 -10
- package/dist/_node-chunks/{chunk-3D4SLKEE.js → chunk-DIZCVGPK.js} +7 -7
- package/dist/_node-chunks/{chunk-IRMNO3QS.js → chunk-F347QVLI.js} +9 -9
- package/dist/_node-chunks/{chunk-GYJ7LPFJ.js → chunk-GJRLPTXZ.js} +13 -13
- package/dist/_node-chunks/{chunk-VK4OWRKU.js → chunk-H4TYBETM.js} +9 -9
- package/dist/_node-chunks/{chunk-V3SFCYKQ.js → chunk-HXE2FZ3F.js} +7 -7
- package/dist/_node-chunks/{chunk-CCJGKJ27.js → chunk-IHBEBZVB.js} +12 -12
- package/dist/_node-chunks/chunk-JK62DOZL.js +23 -0
- package/dist/_node-chunks/{chunk-MU4E5UBA.js → chunk-LMYIILVH.js} +7 -7
- package/dist/_node-chunks/{chunk-5Q5JEISY.js → chunk-N73BCSUL.js} +6 -6
- package/dist/_node-chunks/{chunk-ZOUBYBCH.js → chunk-OT3P3RDM.js} +8 -8
- package/dist/_node-chunks/{chunk-C3FPVGL4.js → chunk-OZGI27C5.js} +6 -6
- package/dist/_node-chunks/{chunk-DJ3RRSJ7.js → chunk-OZHRGJKY.js} +7 -7
- package/dist/_node-chunks/chunk-Q3WHGQXN.js +18 -0
- package/dist/_node-chunks/{chunk-VTBZVEBF.js → chunk-QNYGS5WG.js} +8 -8
- package/dist/_node-chunks/{chunk-VT2FICF4.js → chunk-QXDUEJWP.js} +6 -6
- package/dist/_node-chunks/{chunk-PWI3ORDV.js → chunk-USLMTVEL.js} +20 -20
- package/dist/_node-chunks/{chunk-G7P42ZEY.js → chunk-XH6HLMNG.js} +7 -7
- package/dist/_node-chunks/{chunk-XTIFAWOB.js → chunk-ZUTW3EKD.js} +16 -16
- package/dist/_node-chunks/{globby-4BDMCAAD.js → globby-IVEL6LAU.js} +9 -9
- package/dist/_node-chunks/{lib-XS2XQMOO.js → lib-IDUN2DHZ.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-JFERGMQH.js → mdx-N42X6CFJ-V7NAUWUX.js} +8 -8
- package/dist/_node-chunks/{p-limit-I4CLTHWH.js → p-limit-VA3OYXXM.js} +7 -7
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +12 -12
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +18 -18
- package/dist/common/index.js +19 -19
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +55 -60
- package/dist/core-server/index.d.ts +6 -1
- package/dist/core-server/index.js +36 -35
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +87 -100
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +102 -80
- package/dist/manager/runtime.js +812 -69
- package/dist/manager-api/index.d.ts +2 -0
- package/dist/manager-api/index.js +10 -2
- package/dist/mocking-utils/index.js +8 -8
- package/dist/node-logger/index.js +9 -9
- package/dist/server-errors.js +11 -11
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.js +23 -23
- package/dist/theming/index.js +16 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -1
- package/dist/_node-chunks/chunk-CBPOKBOR.js +0 -18
- package/dist/_node-chunks/chunk-EG3WZ464.js +0 -23
- package/dist/_node-chunks/chunk-RGEHGZS6.js +0 -61
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bfa4dw0yocr from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bfa4dw0yocr from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bfa4dw0yocr from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bfa4dw0yocr.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bfa4dw0yocr.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bfa4dw0yocr.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "../../_node-chunks/chunk-
|
|
12
|
+
import "../../_node-chunks/chunk-IHBEBZVB.js";
|
|
13
13
|
import {
|
|
14
14
|
doesStoryFileExist,
|
|
15
15
|
generateStoryFile,
|
|
@@ -17,47 +17,47 @@ import {
|
|
|
17
17
|
parseStaticDir,
|
|
18
18
|
sendTelemetryError,
|
|
19
19
|
throttle
|
|
20
|
-
} from "../../_node-chunks/chunk-
|
|
21
|
-
import "../../_node-chunks/chunk-
|
|
22
|
-
import "../../_node-chunks/chunk-
|
|
23
|
-
import "../../_node-chunks/chunk-
|
|
20
|
+
} from "../../_node-chunks/chunk-ZUTW3EKD.js";
|
|
21
|
+
import "../../_node-chunks/chunk-JK62DOZL.js";
|
|
22
|
+
import "../../_node-chunks/chunk-4PWGJYBL.js";
|
|
23
|
+
import "../../_node-chunks/chunk-54FLVGBQ.js";
|
|
24
24
|
import {
|
|
25
25
|
isI18nPackage,
|
|
26
26
|
isRouterPackage,
|
|
27
27
|
isStateManagementPackage,
|
|
28
28
|
isStylingPackage
|
|
29
|
-
} from "../../_node-chunks/chunk-
|
|
29
|
+
} from "../../_node-chunks/chunk-GJRLPTXZ.js";
|
|
30
30
|
import {
|
|
31
31
|
globalSettings
|
|
32
|
-
} from "../../_node-chunks/chunk-
|
|
32
|
+
} from "../../_node-chunks/chunk-H4TYBETM.js";
|
|
33
33
|
import {
|
|
34
34
|
invariant
|
|
35
|
-
} from "../../_node-chunks/chunk-
|
|
36
|
-
import "../../_node-chunks/chunk-
|
|
35
|
+
} from "../../_node-chunks/chunk-OZGI27C5.js";
|
|
36
|
+
import "../../_node-chunks/chunk-6TOW3ZMZ.js";
|
|
37
37
|
import {
|
|
38
38
|
resolvePackageDir
|
|
39
|
-
} from "../../_node-chunks/chunk-
|
|
39
|
+
} from "../../_node-chunks/chunk-DIZCVGPK.js";
|
|
40
40
|
import {
|
|
41
41
|
isAbsolute,
|
|
42
42
|
join
|
|
43
|
-
} from "../../_node-chunks/chunk-
|
|
43
|
+
} from "../../_node-chunks/chunk-N73BCSUL.js";
|
|
44
44
|
import {
|
|
45
45
|
glob
|
|
46
|
-
} from "../../_node-chunks/chunk-
|
|
47
|
-
import "../../_node-chunks/chunk-
|
|
46
|
+
} from "../../_node-chunks/chunk-OZHRGJKY.js";
|
|
47
|
+
import "../../_node-chunks/chunk-QNYGS5WG.js";
|
|
48
48
|
import {
|
|
49
49
|
require_dist
|
|
50
|
-
} from "../../_node-chunks/chunk-
|
|
51
|
-
import "../../_node-chunks/chunk-
|
|
52
|
-
import "../../_node-chunks/chunk-
|
|
50
|
+
} from "../../_node-chunks/chunk-XH6HLMNG.js";
|
|
51
|
+
import "../../_node-chunks/chunk-F347QVLI.js";
|
|
52
|
+
import "../../_node-chunks/chunk-LMYIILVH.js";
|
|
53
53
|
import {
|
|
54
54
|
require_picocolors
|
|
55
|
-
} from "../../_node-chunks/chunk-
|
|
55
|
+
} from "../../_node-chunks/chunk-A2364FS2.js";
|
|
56
56
|
import {
|
|
57
57
|
__commonJS,
|
|
58
58
|
__require,
|
|
59
59
|
__toESM
|
|
60
|
-
} from "../../_node-chunks/chunk-
|
|
60
|
+
} from "../../_node-chunks/chunk-5BYTBW23.js";
|
|
61
61
|
|
|
62
62
|
// ../../node_modules/shell-quote/quote.js
|
|
63
63
|
var require_quote = __commonJS({
|
|
@@ -650,7 +650,7 @@ async function searchFiles({
|
|
|
650
650
|
ignoredFiles = IGNORED_FILES,
|
|
651
651
|
fileExtensions = FILE_EXTENSIONS
|
|
652
652
|
}) {
|
|
653
|
-
let { globby, isDynamicPattern } = await import("../../_node-chunks/globby-
|
|
653
|
+
let { globby, isDynamicPattern } = await import("../../_node-chunks/globby-IVEL6LAU.js"), hasSearchSpecialGlobChars = isDynamicPattern(searchQuery, { cwd }), searchQueryHasExtension = /(\.[a-z]+)$/i.test(searchQuery), fileExtensionsPattern = `{${fileExtensions.join(",")}}`, globbedSearchQuery = hasSearchSpecialGlobChars ? searchQuery : searchQueryHasExtension ? [`**/*${searchQuery}*`, `**/*${searchQuery}*/**`] : [
|
|
654
654
|
`**/*${searchQuery}*.${fileExtensionsPattern}`,
|
|
655
655
|
`**/*${searchQuery}*/**/*.${fileExtensionsPattern}`
|
|
656
656
|
];
|
|
@@ -841,8 +841,7 @@ async function getComponentCandidates({
|
|
|
841
841
|
candidates,
|
|
842
842
|
globMatchCount
|
|
843
843
|
};
|
|
844
|
-
} catch
|
|
845
|
-
let errorMessage = error instanceof Error ? error.message : String(error);
|
|
844
|
+
} catch {
|
|
846
845
|
return {
|
|
847
846
|
candidates: [],
|
|
848
847
|
error: "Failed to find candidates",
|
|
@@ -868,7 +867,11 @@ var ERROR_CATEGORIES = {
|
|
|
868
867
|
MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
|
|
869
868
|
COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
|
|
870
869
|
SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
|
|
871
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
870
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
871
|
+
// Vite related errors
|
|
872
|
+
DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
|
|
873
|
+
// Vitest test run related errors
|
|
874
|
+
TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
|
|
872
875
|
};
|
|
873
876
|
function buildErrorContext(message, stack) {
|
|
874
877
|
let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
|
|
@@ -891,6 +894,16 @@ var CATEGORIZATION_RULES = [
|
|
|
891
894
|
priority: 100,
|
|
892
895
|
match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
|
|
893
896
|
},
|
|
897
|
+
{
|
|
898
|
+
category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
|
|
899
|
+
priority: 95,
|
|
900
|
+
match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
|
|
904
|
+
priority: 95,
|
|
905
|
+
match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
|
|
906
|
+
},
|
|
894
907
|
{
|
|
895
908
|
category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
|
|
896
909
|
priority: 90,
|
|
@@ -958,45 +971,19 @@ function getMatchedDependencies(category, ctx) {
|
|
|
958
971
|
return [];
|
|
959
972
|
}
|
|
960
973
|
}
|
|
961
|
-
function getCategoryDescription(category) {
|
|
962
|
-
switch (category) {
|
|
963
|
-
case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
|
|
964
|
-
return "Component attempted to access shared state without a state management provider";
|
|
965
|
-
case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
|
|
966
|
-
return "Component attempted to access routing context without a router provider";
|
|
967
|
-
case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
|
|
968
|
-
return "Component attempted to access theme values without a theme provider";
|
|
969
|
-
case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
|
|
970
|
-
return "Component attempted to access translations without a translation provider";
|
|
971
|
-
case ERROR_CATEGORIES.MISSING_PROVIDER:
|
|
972
|
-
return "Component attempted to access React context without a matching provider";
|
|
973
|
-
case ERROR_CATEGORIES.MISSING_PORTAL_ROOT:
|
|
974
|
-
return "Component attempted to render a portal without a valid DOM container";
|
|
975
|
-
case ERROR_CATEGORIES.HOOK_USAGE_ERROR:
|
|
976
|
-
return "React hook was used incorrectly";
|
|
977
|
-
case ERROR_CATEGORIES.MODULE_IMPORT_ERROR:
|
|
978
|
-
return "A required dependency could not be resolved";
|
|
979
|
-
case ERROR_CATEGORIES.COMPONENT_RENDER_ERROR:
|
|
980
|
-
return "Component failed during render due to a runtime error";
|
|
981
|
-
case ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR:
|
|
982
|
-
return "Server components usage in the browser";
|
|
983
|
-
default:
|
|
984
|
-
return "Error could not be categorized";
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
974
|
|
|
988
975
|
// src/core-server/utils/ghost-stories/parse-vitest-report.ts
|
|
989
976
|
function extractCategorizedErrors(testResults) {
|
|
990
977
|
let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
|
|
991
978
|
for (let r of failed) {
|
|
992
979
|
let { category, matchedDependencies } = categorizeError(r.error, r.stack);
|
|
993
|
-
map.has(category) || map.set(category, { count: 0, matchedDependencies: /* @__PURE__ */ new Set() });
|
|
980
|
+
map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
|
|
994
981
|
let data = map.get(category);
|
|
995
|
-
data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error);
|
|
982
|
+
data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
|
|
996
983
|
}
|
|
997
984
|
let categorizedErrors = Array.from(map.entries()).reduce(
|
|
998
985
|
(acc, [category, data]) => (acc[category] = {
|
|
999
|
-
|
|
986
|
+
uniqueCount: data.uniqueErrors.size,
|
|
1000
987
|
count: data.count,
|
|
1001
988
|
matchedDependencies: Array.from(data.matchedDependencies).sort()
|
|
1002
989
|
}, acc),
|
|
@@ -1008,12 +995,12 @@ function extractCategorizedErrors(testResults) {
|
|
|
1008
995
|
categorizedErrors
|
|
1009
996
|
};
|
|
1010
997
|
}
|
|
1011
|
-
function parseVitestResults(
|
|
998
|
+
function parseVitestResults(report) {
|
|
1012
999
|
let storyTestResults = [], passedButEmptyRender = 0;
|
|
1013
|
-
for (let testSuite of
|
|
1000
|
+
for (let testSuite of report.testResults)
|
|
1014
1001
|
for (let assertion of testSuite.assertionResults) {
|
|
1015
1002
|
let storyId = assertion.meta?.storyId || assertion.fullName, status = assertion.status === "passed" ? "PASS" : assertion.status === "failed" ? "FAIL" : "PENDING", hasEmptyRender = assertion.meta?.reports?.some(
|
|
1016
|
-
(
|
|
1003
|
+
(report2) => report2.type === "render-analysis" && report2.result?.emptyRender === !0
|
|
1017
1004
|
);
|
|
1018
1005
|
status === "PASS" && hasEmptyRender && passedButEmptyRender++;
|
|
1019
1006
|
let error, stack;
|
|
@@ -1025,20 +1012,17 @@ function parseVitestResults(testResults) {
|
|
|
1025
1012
|
stack
|
|
1026
1013
|
});
|
|
1027
1014
|
}
|
|
1028
|
-
let total =
|
|
1029
|
-
total,
|
|
1030
|
-
passed,
|
|
1031
|
-
passedButEmptyRender,
|
|
1032
|
-
failed,
|
|
1033
|
-
successRate,
|
|
1034
|
-
successRateWithoutEmptyRender,
|
|
1035
|
-
failureRate,
|
|
1036
|
-
uniqueErrorCount: errorClassification.uniqueErrorCount,
|
|
1037
|
-
categorizedErrors
|
|
1038
|
-
};
|
|
1015
|
+
let total = report.numTotalTests, passed = report.numPassedTests, successRate = total > 0 ? parseFloat((passed / total).toFixed(2)) : 0, successRateWithoutEmptyRender = total > 0 ? parseFloat(((passed - passedButEmptyRender) / total).toFixed(2)) : 0, errorClassification = extractCategorizedErrors(storyTestResults), categorizedErrors = errorClassification.categorizedErrors;
|
|
1039
1016
|
return {
|
|
1040
|
-
|
|
1041
|
-
|
|
1017
|
+
summary: {
|
|
1018
|
+
total,
|
|
1019
|
+
passed,
|
|
1020
|
+
passedButEmptyRender,
|
|
1021
|
+
successRate,
|
|
1022
|
+
successRateWithoutEmptyRender,
|
|
1023
|
+
uniqueErrorCount: errorClassification.uniqueErrorCount,
|
|
1024
|
+
categorizedErrors
|
|
1025
|
+
}
|
|
1042
1026
|
};
|
|
1043
1027
|
}
|
|
1044
1028
|
|
|
@@ -1071,32 +1055,31 @@ async function runStoryTests(componentFilePaths) {
|
|
|
1071
1055
|
let duration = Date.now() - startTime;
|
|
1072
1056
|
if (testFailureMessage)
|
|
1073
1057
|
return {
|
|
1074
|
-
success: !1,
|
|
1075
1058
|
duration,
|
|
1076
|
-
|
|
1059
|
+
runError: testFailureMessage
|
|
1077
1060
|
};
|
|
1078
1061
|
if (!existsSync(outputFile))
|
|
1079
1062
|
return {
|
|
1080
|
-
success: !1,
|
|
1081
1063
|
duration,
|
|
1082
|
-
|
|
1064
|
+
runError: "JSON report not found"
|
|
1083
1065
|
};
|
|
1084
|
-
let
|
|
1066
|
+
let vitestReport;
|
|
1085
1067
|
try {
|
|
1086
1068
|
let resultsJson = await readFile3(outputFile, "utf8");
|
|
1087
|
-
|
|
1069
|
+
vitestReport = JSON.parse(resultsJson);
|
|
1088
1070
|
} catch {
|
|
1089
1071
|
return {
|
|
1090
|
-
success: !1,
|
|
1091
1072
|
duration,
|
|
1092
|
-
|
|
1073
|
+
runError: "Failed to read or parse JSON report"
|
|
1093
1074
|
};
|
|
1094
1075
|
}
|
|
1095
|
-
return
|
|
1076
|
+
return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
|
|
1077
|
+
duration,
|
|
1078
|
+
runError: "No tests found"
|
|
1079
|
+
} : { ...parseVitestResults(vitestReport), duration };
|
|
1096
1080
|
} catch {
|
|
1097
1081
|
return {
|
|
1098
|
-
|
|
1099
|
-
error: "Uncaught error running story tests",
|
|
1082
|
+
runError: "Uncaught error running story tests",
|
|
1100
1083
|
duration: 0
|
|
1101
1084
|
};
|
|
1102
1085
|
}
|
|
@@ -1107,8 +1090,11 @@ function initGhostStoriesChannel(channel, options, coreOptions) {
|
|
|
1107
1090
|
return coreOptions.disableTelemetry || channel.on(GHOST_STORIES_REQUEST, async () => {
|
|
1108
1091
|
let stats = {};
|
|
1109
1092
|
try {
|
|
1110
|
-
let ghostRunStart = Date.now(), lastEvents = await getLastEvents(),
|
|
1111
|
-
if (lastEvents
|
|
1093
|
+
let ghostRunStart = Date.now(), lastEvents = await getLastEvents(), lastInit = lastEvents?.init;
|
|
1094
|
+
if (!lastEvents || !lastInit)
|
|
1095
|
+
return;
|
|
1096
|
+
let sessionId = await getSessionId();
|
|
1097
|
+
if (lastEvents["ghost-stories"] || lastInit.body?.sessionId && lastInit.body.sessionId !== sessionId)
|
|
1112
1098
|
return;
|
|
1113
1099
|
let metadata = await getStorybookMetadata(options.configDir), isReactStorybook = metadata?.renderer?.includes("@storybook/react"), hasVitestAddon = !!metadata?.addons && Object.keys(metadata.addons).some(
|
|
1114
1100
|
(addonKey) => addonKey.includes("@storybook/addon-vitest")
|
|
@@ -1118,33 +1104,34 @@ function initGhostStoriesChannel(channel, options, coreOptions) {
|
|
|
1118
1104
|
let candidateAnalysisStart = Date.now(), candidatesResult = await getComponentCandidates();
|
|
1119
1105
|
if (stats.candidateAnalysisDuration = Date.now() - candidateAnalysisStart, stats.globMatchCount = candidatesResult.globMatchCount, stats.analyzedCount = candidatesResult.analyzedCount ?? 0, stats.avgComplexity = candidatesResult.avgComplexity ?? 0, stats.candidateCount = candidatesResult.candidates.length, candidatesResult.error) {
|
|
1120
1106
|
stats.totalRunDuration = Date.now() - ghostRunStart, telemetry3("ghost-stories", {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
stats
|
|
1107
|
+
stats,
|
|
1108
|
+
runError: candidatesResult.error
|
|
1124
1109
|
});
|
|
1125
1110
|
return;
|
|
1126
1111
|
}
|
|
1127
1112
|
if (candidatesResult.candidates.length === 0) {
|
|
1128
1113
|
stats.totalRunDuration = Date.now() - ghostRunStart, telemetry3("ghost-stories", {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
stats
|
|
1114
|
+
stats,
|
|
1115
|
+
runError: "No candidates found"
|
|
1132
1116
|
});
|
|
1133
1117
|
return;
|
|
1134
1118
|
}
|
|
1135
1119
|
let testRunResult = await runStoryTests(candidatesResult.candidates);
|
|
1136
|
-
stats.totalRunDuration = Date.now() - ghostRunStart, stats.testRunDuration = testRunResult.duration,
|
|
1137
|
-
|
|
1138
|
-
|
|
1120
|
+
if (stats.totalRunDuration = Date.now() - ghostRunStart, stats.testRunDuration = testRunResult.duration, testRunResult.runError) {
|
|
1121
|
+
telemetry3("ghost-stories", {
|
|
1122
|
+
stats,
|
|
1123
|
+
runError: testRunResult.runError
|
|
1124
|
+
});
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
telemetry3("ghost-stories", {
|
|
1139
1128
|
stats,
|
|
1140
1129
|
results: testRunResult.summary
|
|
1141
1130
|
});
|
|
1142
|
-
} catch
|
|
1143
|
-
let errorMessage = error instanceof Error ? error.message : String(error);
|
|
1131
|
+
} catch {
|
|
1144
1132
|
telemetry3("ghost-stories", {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
stats
|
|
1133
|
+
stats,
|
|
1134
|
+
runError: "Unknown error during ghost run"
|
|
1148
1135
|
});
|
|
1149
1136
|
} finally {
|
|
1150
1137
|
channel.emit(GHOST_STORIES_RESPONSE);
|
package/dist/csf-tools/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bfa4dw0yocr from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bfa4dw0yocr from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bfa4dw0yocr from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bfa4dw0yocr.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bfa4dw0yocr.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bfa4dw0yocr.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -39,9 +39,9 @@ import {
|
|
|
39
39
|
vitestTransform,
|
|
40
40
|
writeConfig,
|
|
41
41
|
writeCsf
|
|
42
|
-
} from "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
42
|
+
} from "../_node-chunks/chunk-QNYGS5WG.js";
|
|
43
|
+
import "../_node-chunks/chunk-XH6HLMNG.js";
|
|
44
|
+
import "../_node-chunks/chunk-5BYTBW23.js";
|
|
45
45
|
export {
|
|
46
46
|
BadMetaError,
|
|
47
47
|
ConfigFile,
|