Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions commands/generate_reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ function download_artefact(
.then((response) => {
response_code = response.status;
resp = response;
response.data.pipe(
fs.createWriteStream(file_path, {
overwrite: true,
})
);
const writer = fs.createWriteStream(file_path, {overwrite: true,});
response.data.pipe(writer);

response.data.on('end', function () {
writer.on('finish', function () {
if (response_code == 200) {
const zip = new StreamZip({ file: file_path });
zip.on("ready", () => {
Expand All @@ -70,13 +67,20 @@ function download_artefact(
}
});

writer.on('error', (err) => {
console.error('Error writing to file:', err);
fs.unlinkSync(file_path); // Cleanup on error
reject('Error writing to file for test id ' + test_id);
});

})
.catch((error) => {

if (error.response) {
resp = error.response
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log("Got error:",error.response);
if (error.response.status == 401) {
resolve("Unauthorized");
} else {
Expand All @@ -95,6 +99,7 @@ function download_artefact(
} else if (error.request) {
console.log(error.cause);
} else {
console.log("Got error:",error.toJSON());
reject(error);
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambdatest-cypress-cli",
"version": "3.0.30",
"version": "3.0.31",
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
"author": "LambdaTest <[email protected]>",
Expand Down