Skip to content

Commit

Permalink
Improve error handling when no report file generated (#230)
Browse files Browse the repository at this point in the history
* Improve error handling when no report file generated

* update type of variable

* add debug info

* add debug info

* remove debug info
  • Loading branch information
tianfeng92 authored Mar 24, 2023
1 parent 1f28e35 commit 48a8f40
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cypress-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ const report = async (results = {}, statusCode, browserName, runCfg, suiteName,
);

try {
let reportJSON = afterRunTestReport(results);
const filepath = path.join(runCfg.resultsDir, 'sauce-test-report.json');
reportJSON.toFile(filepath);
assets.push(filepath);
const reportJSON = await afterRunTestReport(results);
if (reportJSON) {
const filepath = path.join(runCfg.resultsDir, 'sauce-test-report.json');
reportJSON.toFile(filepath);
assets.push(filepath);
}
} catch (e) {
console.error('Failed to serialize test results: ', e);
}
Expand Down

0 comments on commit 48a8f40

Please sign in to comment.