@jsenv/core 27.5.2 → 27.5.3
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/js/html_supervisor_installer.js +42 -26
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/src/plugins/html_supervisor/client/error_formatter.js +6 -1
- package/src/plugins/html_supervisor/client/error_overlay.js +21 -0
- package/src/plugins/html_supervisor/client/html_supervisor_installer.js +21 -27
- package/src/test/execute_test_plan.js +1 -2
|
@@ -131,7 +131,8 @@ const formatError = (error, {
|
|
|
131
131
|
// so use it only when error.stack is not available
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
if (url && !stack)
|
|
134
|
+
if (url && !stack && // ignore window.reportError() it gives no valuable info
|
|
135
|
+
!url.endsWith("html_supervisor_installer.js")) {
|
|
135
136
|
onErrorLocated(resolveUrlSite({
|
|
136
137
|
url,
|
|
137
138
|
line,
|
|
@@ -358,6 +359,7 @@ const link = ({
|
|
|
358
359
|
}) => `<a href="${href}">${text}</a>`;
|
|
359
360
|
|
|
360
361
|
const JSENV_ERROR_OVERLAY_TAGNAME = "jsenv-error-overlay";
|
|
362
|
+
let previousErrorInfo = null;
|
|
361
363
|
const displayErrorInDocument = (error, {
|
|
362
364
|
rootDirectoryUrl,
|
|
363
365
|
errorBaseUrl,
|
|
@@ -369,6 +371,22 @@ const displayErrorInDocument = (error, {
|
|
|
369
371
|
reportedBy,
|
|
370
372
|
requestedRessource
|
|
371
373
|
}) => {
|
|
374
|
+
const nowMs = Date.now(); // ensure error dispatched on window by browser is displayed first
|
|
375
|
+
// then the server error replaces it (because it contains more information)
|
|
376
|
+
|
|
377
|
+
if (previousErrorInfo) {
|
|
378
|
+
const previousErrorReportedBy = previousErrorInfo.reportedBy;
|
|
379
|
+
const msEllapsedSincePreviousError = nowMs - previousErrorInfo.ms;
|
|
380
|
+
|
|
381
|
+
if (previousErrorReportedBy === "server" && reportedBy === "browser" && msEllapsedSincePreviousError < 50) {
|
|
382
|
+
return () => {};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
previousErrorInfo = {
|
|
387
|
+
ms: nowMs,
|
|
388
|
+
reportedBy
|
|
389
|
+
};
|
|
372
390
|
const {
|
|
373
391
|
theme,
|
|
374
392
|
title,
|
|
@@ -815,15 +833,18 @@ const installHtmlSupervisor = ({
|
|
|
815
833
|
}
|
|
816
834
|
|
|
817
835
|
const {
|
|
818
|
-
error
|
|
836
|
+
error,
|
|
837
|
+
filename,
|
|
838
|
+
lineno,
|
|
839
|
+
colno
|
|
819
840
|
} = errorEvent;
|
|
820
841
|
displayErrorInDocument(error, {
|
|
821
842
|
rootDirectoryUrl,
|
|
822
843
|
errorBaseUrl,
|
|
823
844
|
openInEditor,
|
|
824
|
-
url:
|
|
825
|
-
line:
|
|
826
|
-
column:
|
|
845
|
+
url: filename,
|
|
846
|
+
line: lineno,
|
|
847
|
+
column: colno,
|
|
827
848
|
reportedBy: "browser"
|
|
828
849
|
});
|
|
829
850
|
});
|
|
@@ -864,27 +885,22 @@ const installHtmlSupervisor = ({
|
|
|
864
885
|
|
|
865
886
|
if (isFaviconAutoRequest) {
|
|
866
887
|
return;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
codeFrame: traceMessage,
|
|
884
|
-
reportedBy: "server",
|
|
885
|
-
requestedRessource
|
|
886
|
-
});
|
|
887
|
-
}, 10);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
displayErrorInDocument({
|
|
891
|
+
message,
|
|
892
|
+
stack
|
|
893
|
+
}, {
|
|
894
|
+
rootDirectoryUrl,
|
|
895
|
+
errorBaseUrl,
|
|
896
|
+
openInEditor,
|
|
897
|
+
url: traceUrl,
|
|
898
|
+
line: traceLine,
|
|
899
|
+
column: traceColumn,
|
|
900
|
+
codeFrame: traceMessage,
|
|
901
|
+
reportedBy: "server",
|
|
902
|
+
requestedRessource
|
|
903
|
+
});
|
|
888
904
|
}
|
|
889
905
|
});
|
|
890
906
|
}
|
package/dist/main.js
CHANGED
|
@@ -25715,7 +25715,7 @@ const executeTestPlan = async ({
|
|
|
25715
25715
|
keepRunning = false,
|
|
25716
25716
|
cooldownBetweenExecutions = 0,
|
|
25717
25717
|
gcBetweenExecutions = logMemoryHeapUsage,
|
|
25718
|
-
coverageEnabled = process.argv.includes("--
|
|
25718
|
+
coverageEnabled = process.argv.includes("--coverage"),
|
|
25719
25719
|
coverageConfig = {
|
|
25720
25720
|
"./src/": true
|
|
25721
25721
|
},
|
package/package.json
CHANGED
|
@@ -103,7 +103,12 @@ export const formatError = (
|
|
|
103
103
|
|
|
104
104
|
// error.stack is more reliable than url/line/column reported on window error events
|
|
105
105
|
// so use it only when error.stack is not available
|
|
106
|
-
if (
|
|
106
|
+
if (
|
|
107
|
+
url &&
|
|
108
|
+
!stack &&
|
|
109
|
+
// ignore window.reportError() it gives no valuable info
|
|
110
|
+
!url.endsWith("html_supervisor_installer.js")
|
|
111
|
+
) {
|
|
107
112
|
onErrorLocated(resolveUrlSite({ url, line, column }))
|
|
108
113
|
}
|
|
109
114
|
|
|
@@ -2,6 +2,8 @@ import { formatError } from "./error_formatter.js"
|
|
|
2
2
|
|
|
3
3
|
const JSENV_ERROR_OVERLAY_TAGNAME = "jsenv-error-overlay"
|
|
4
4
|
|
|
5
|
+
let previousErrorInfo = null
|
|
6
|
+
|
|
5
7
|
export const displayErrorInDocument = (
|
|
6
8
|
error,
|
|
7
9
|
{
|
|
@@ -16,6 +18,25 @@ export const displayErrorInDocument = (
|
|
|
16
18
|
requestedRessource,
|
|
17
19
|
},
|
|
18
20
|
) => {
|
|
21
|
+
const nowMs = Date.now()
|
|
22
|
+
// ensure error dispatched on window by browser is displayed first
|
|
23
|
+
// then the server error replaces it (because it contains more information)
|
|
24
|
+
if (previousErrorInfo) {
|
|
25
|
+
const previousErrorReportedBy = previousErrorInfo.reportedBy
|
|
26
|
+
const msEllapsedSincePreviousError = nowMs - previousErrorInfo.ms
|
|
27
|
+
if (
|
|
28
|
+
previousErrorReportedBy === "server" &&
|
|
29
|
+
reportedBy === "browser" &&
|
|
30
|
+
msEllapsedSincePreviousError < 50
|
|
31
|
+
) {
|
|
32
|
+
return () => {}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
previousErrorInfo = {
|
|
36
|
+
ms: nowMs,
|
|
37
|
+
reportedBy,
|
|
38
|
+
}
|
|
39
|
+
|
|
19
40
|
const { theme, title, text, codeFramePromise, tip } = formatError(error, {
|
|
20
41
|
rootDirectoryUrl,
|
|
21
42
|
errorBaseUrl,
|
|
@@ -225,14 +225,14 @@ export const installHtmlSupervisor = ({
|
|
|
225
225
|
// ignore custom error event (not sent by browser)
|
|
226
226
|
return
|
|
227
227
|
}
|
|
228
|
-
const { error } = errorEvent
|
|
228
|
+
const { error, filename, lineno, colno } = errorEvent
|
|
229
229
|
displayErrorInDocument(error, {
|
|
230
230
|
rootDirectoryUrl,
|
|
231
231
|
errorBaseUrl,
|
|
232
232
|
openInEditor,
|
|
233
|
-
url:
|
|
234
|
-
line:
|
|
235
|
-
column:
|
|
233
|
+
url: filename,
|
|
234
|
+
line: lineno,
|
|
235
|
+
column: colno,
|
|
236
236
|
reportedBy: "browser",
|
|
237
237
|
})
|
|
238
238
|
})
|
|
@@ -252,7 +252,6 @@ export const installHtmlSupervisor = ({
|
|
|
252
252
|
}
|
|
253
253
|
return false
|
|
254
254
|
}
|
|
255
|
-
|
|
256
255
|
window.__server_events__.addEventCallbacks({
|
|
257
256
|
error_while_serving_file: (serverErrorEvent) => {
|
|
258
257
|
if (!isExecuting()) {
|
|
@@ -271,28 +270,23 @@ export const installHtmlSupervisor = ({
|
|
|
271
270
|
if (isFaviconAutoRequest) {
|
|
272
271
|
return
|
|
273
272
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
reportedBy: "server",
|
|
292
|
-
requestedRessource,
|
|
293
|
-
},
|
|
294
|
-
)
|
|
295
|
-
}, 10)
|
|
273
|
+
displayErrorInDocument(
|
|
274
|
+
{
|
|
275
|
+
message,
|
|
276
|
+
stack,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
rootDirectoryUrl,
|
|
280
|
+
errorBaseUrl,
|
|
281
|
+
openInEditor,
|
|
282
|
+
url: traceUrl,
|
|
283
|
+
line: traceLine,
|
|
284
|
+
column: traceColumn,
|
|
285
|
+
codeFrame: traceMessage,
|
|
286
|
+
reportedBy: "server",
|
|
287
|
+
requestedRessource,
|
|
288
|
+
},
|
|
289
|
+
)
|
|
296
290
|
},
|
|
297
291
|
})
|
|
298
292
|
}
|
|
@@ -60,8 +60,7 @@ export const executeTestPlan = async ({
|
|
|
60
60
|
cooldownBetweenExecutions = 0,
|
|
61
61
|
gcBetweenExecutions = logMemoryHeapUsage,
|
|
62
62
|
|
|
63
|
-
coverageEnabled = process.argv.includes("--
|
|
64
|
-
process.argv.includes("--coverage"),
|
|
63
|
+
coverageEnabled = process.argv.includes("--coverage"),
|
|
65
64
|
coverageConfig = {
|
|
66
65
|
"./src/": true,
|
|
67
66
|
},
|