1
1
const fs = require ( 'fs' ) ,
2
2
path = require ( 'path' ) ,
3
3
request = require ( 'request' ) ,
4
+ unzipper = require ( 'unzipper' ) ,
4
5
logger = require ( './logger' ) . winstonLogger ,
5
6
utils = require ( "./utils" ) ,
6
7
Constants = require ( './constants' ) ,
7
8
config = require ( "./config" ) ;
8
- const unzipper = require ( 'unzipper' ) ;
9
9
10
10
let reportGenerator = ( bsConfig , buildId , args , rawArgs , buildReportData , cb ) => {
11
11
let options = {
@@ -19,6 +19,8 @@ let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) =>
19
19
} ,
20
20
} ;
21
21
22
+ logger . debug ( 'Started fetching the build json and html reports.' ) ;
23
+
22
24
return request . get ( options , async function ( err , resp , body ) {
23
25
let message = null ;
24
26
let messageType = null ;
@@ -84,6 +86,7 @@ let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) =>
84
86
await generateCypressBuildReport ( build ) ;
85
87
logger . info ( message ) ;
86
88
}
89
+ logger . debug ( 'Finished fetching the build json and html reports.' ) ;
87
90
utils . sendUsageReport ( bsConfig , args , message , messageType , errorCode , buildReportData , rawArgs ) ;
88
91
if ( cb ) {
89
92
cb ( ) ;
@@ -95,6 +98,9 @@ async function generateCypressBuildReport(report_data) {
95
98
let resultsDir = path . join ( './' , 'results' ) ;
96
99
97
100
if ( ! fs . existsSync ( resultsDir ) ) {
101
+ logger . debug ( "results directory doesn't exists" ) ;
102
+ logger . info ( ) ;
103
+ logger . debug ( "creating results directory" ) ;
98
104
fs . mkdirSync ( resultsDir ) ;
99
105
}
100
106
await getReportResponse ( resultsDir , 'report.zip' , report_data . cypress_custom_report_url )
@@ -120,6 +126,7 @@ function getReportResponse(filePath, fileName, reportJsonUrl) {
120
126
} ) ;
121
127
writer . on ( 'close' , async ( ) => {
122
128
if ( ! error ) {
129
+ logger . debug ( "Unzipping downloaded html and json reports." ) ;
123
130
await unzipFile ( filePath , fileName ) ;
124
131
fs . unlinkSync ( tmpFilePath ) ;
125
132
resolve ( true ) ;
0 commit comments