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) {
9393 args [ "session_id" ] == "" ||
9494 args [ "session_id" ] == undefined
9595 ) {
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+ }
97115 }
98116
99117 //set working enviornment
Original file line number Diff line number Diff line change @@ -197,7 +197,6 @@ const argv = require("yargs")
197197 alias : "username" ,
198198 describe : "Lambdatest Username of User" ,
199199 type : "string" ,
200- demandOption : true ,
201200 } )
202201 . option ( "ak" , {
203202 alias : "access_key" ,
You can’t perform that action at this time.
0 commit comments