Skip to content

Commit d5f3f8b

Browse files
committed
Report error path
1 parent 7e084a2 commit d5f3f8b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cypress/e2e/trafficlight/trafficlight.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ type JSONValue =
5555
Cypress.on('uncaught:exception', (e, runnable) => {
5656
console.log("uncaught exception", e.message);
5757
const errorUrl = `${Cypress.env('TRAFFICLIGHT_URL') }/client/${ Cypress.env('TRAFFICLIGHT_UUID') }/error`;
58-
console.log(e.message);
58+
const errorPath = e.stack?.split("\n")[0];
5959
const body = JSON.stringify({
6060
error: {
6161
type: e.name,
6262
details: e.message,
63-
path: "foo/bar",
63+
path: errorPath,
6464
},
6565
});
6666
fetch(errorUrl, { method: "POST", body });
@@ -69,12 +69,12 @@ Cypress.on('uncaught:exception', (e, runnable) => {
6969

7070
Cypress.on('fail', (e) => {
7171
const errorUrl = `${Cypress.env('TRAFFICLIGHT_URL') }/client/${ Cypress.env('TRAFFICLIGHT_UUID') }/error`;
72-
console.log("fail", e.message);
72+
const errorPath = e.stack?.split("\n").slice(1).join("\n");
7373
const body = JSON.stringify({
7474
error: {
7575
type: e.name,
7676
details: e.message,
77-
path: "foo/bar",
77+
path: errorPath,
7878
},
7979
});
8080
fetch(errorUrl, {

0 commit comments

Comments
 (0)