File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,25 @@ function generate_report(args) {
93
93
args [ "session_id" ] == "" ||
94
94
args [ "session_id" ] == undefined
95
95
) {
96
- reject ( "Please provide a Session ID" ) ;
96
+ const file_path = "lambdatest_run.json" ;
97
+ if ( fs . existsSync ( file_path ) ) {
98
+ let lambda_run = fs . readFileSync ( file_path ) ;
99
+ try {
100
+ let lambda_run_obj = JSON . parse ( lambda_run ) ;
101
+ if ( ! ( "session_id" in lambda_run_obj ) ) {
102
+ throw new Error ( "session_id is missing from the file" ) ;
103
+ }
104
+ args . session_id = lambda_run_obj . session_id ;
105
+ } catch ( e ) {
106
+ reject (
107
+ "Error!! lambdatest_run.json file is tampered Err: " + e . message
108
+ ) ;
109
+ }
110
+ } else {
111
+ reject (
112
+ "Error!! Last session details not found, lambdatest_run.json file not present!!"
113
+ ) ;
114
+ }
97
115
}
98
116
99
117
//set working enviornment
Original file line number Diff line number Diff line change @@ -197,7 +197,6 @@ const argv = require("yargs")
197
197
alias : "username" ,
198
198
describe : "Lambdatest Username of User" ,
199
199
type : "string" ,
200
- demandOption : true ,
201
200
} )
202
201
. option ( "ak" , {
203
202
alias : "access_key" ,
You can’t perform that action at this time.
0 commit comments