Skip to content

Commit b46052a

Browse files
committed
Merge branch 'fix_corrupt_reports_issue_fix' of github.com:browserstack/browserstack-cypress-cli into add_decompress_support
2 parents 6e12065 + 4708ede commit b46052a

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

bin/helpers/buildArtifacts.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const logger = require('./logger').winstonLogger,
1111
config = require("./config");
1212

1313
const request = require('request');
14+
const decompress = require('decompress');
1415

1516

1617
let BUILD_ARTIFACTS_TOTAL_COUNT = 0;
@@ -127,10 +128,13 @@ const downloadAndUnzip = async (filePath, fileName, url) => {
127128

128129
const unzipFile = async (filePath, fileName) => {
129130
return new Promise( async (resolve, reject) => {
130-
await unzipper.Open.file(path.join(filePath, fileName))
131-
.then(d => d.extract({path: filePath, concurrency: 5}))
132-
.catch((err) => reject(err));
133-
resolve();
131+
await decompress(path.join(filePath, fileName), filePath)
132+
.then((files) => {
133+
resolve();
134+
})
135+
.catch((error) => {
136+
reject(error);
137+
});
134138
});
135139
}
136140

bin/helpers/reporterHTML.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const fs = require('fs'),
55
logger = require('./logger').winstonLogger,
66
utils = require("./utils"),
77
Constants = require('./constants'),
8-
config = require("./config");
8+
config = require("./config"),
9+
decompress = require('decompress');
910

1011
let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) => {
1112
let options = {
@@ -150,14 +151,15 @@ function getReportResponse(filePath, fileName, reportJsonUrl) {
150151

151152
const unzipFile = async (filePath, fileName) => {
152153
return new Promise( async (resolve, reject) => {
153-
await unzipper.Open.file(path.join(filePath, fileName))
154-
.then(d => d.extract({path: filePath, concurrency: 5}))
155-
.catch((err) => {
156-
reject(err);
157-
process.exitCode = Constants.ERROR_EXIT_CODE;
158-
});
154+
await decompress(path.join(filePath, fileName), filePath)
155+
.then((files) => {
159156
let message = "Unzipped the json and html successfully."
160157
resolve(message);
158+
})
159+
.catch((error) => {
160+
reject(error);
161+
process.exitCode = Constants.ERROR_EXIT_CODE;
162+
});
161163
});
162164
}
163165

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"update-notifier": "5.1.0",
2929
"uuid": "8.3.2",
3030
"winston": "2.4.4",
31-
"yargs": "14.2.3"
31+
"yargs": "14.2.3",
32+
"decompress": "4.2.1"
3233
},
3334
"repository": {
3435
"type": "git",

0 commit comments

Comments
 (0)