Skip to content

Commit 466d623

Browse files
author
Archish Thakkar
authored
Merge pull request #672 from browserstack/OBS_2080_handle_log_exception
handle exceptions for > v12.7.0
2 parents d781aa6 + ae01920 commit 466d623

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

bin/testObservability/cypress/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
/* Used to detect Gherkin steps */
44
Cypress.on('log:added', (log) => {
5-
cy.now('task', 'test_observability_step', {
6-
log
7-
}, {log: false}).then((res) => {
8-
}).catch((err) => {
9-
});
5+
return () => {
6+
return cy.now('task', 'test_observability_step', {
7+
log
8+
}, {log: false})
9+
}
1010
});
1111

1212
Cypress.on('command:start', (command) => {

bin/testObservability/reporter/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,14 @@ class MyReporter {
309309
'failure_type': !failureReason ? null : failureReason.match(/AssertionError/) ? 'AssertionError' : 'UnhandledError',
310310
'retry_of': test.retryOf,
311311
'meta': {
312-
steps: JSON.parse(JSON.stringify(this.currentTestCucumberSteps))
312+
steps: []
313313
}
314314
};
315315

316-
this.currentTestCucumberSteps = [];
316+
if(eventType.match(/TestRunFinished/) || eventType.match(/TestRunSkipped/)) {
317+
testData['meta'].steps = JSON.parse(JSON.stringify(this.currentTestCucumberSteps));
318+
this.currentTestCucumberSteps = [];
319+
}
317320

318321
const { os, os_version } = await getOSDetailsFromSystem(process.env.observability_product);
319322
if(process.env.observability_integration) {

0 commit comments

Comments
 (0)