Skip to content

generate report changes #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2022
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
20 changes: 19 additions & 1 deletion commands/generate_reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,25 @@ function generate_report(args) {
args["session_id"] == "" ||
args["session_id"] == undefined
) {
reject("Please provide a Session ID");
const file_path = "lambdatest_run.json";
if (fs.existsSync(file_path)) {
let lambda_run = fs.readFileSync(file_path);
try {
let lambda_run_obj = JSON.parse(lambda_run);
if (!("session_id" in lambda_run_obj)) {
throw new Error("session_id is missing from the file");
}
args.session_id = lambda_run_obj.session_id;
} catch (e) {
reject(
"Error!! lambdatest_run.json file is tampered Err: " + e.message
);
}
} else {
reject(
"Error!! Last session details not found, lambdatest_run.json file not present!!"
);
}
}

//set working enviornment
Expand Down
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const argv = require("yargs")
alias: "username",
describe: "Lambdatest Username of User",
type: "string",
demandOption: true,
})
.option("ak", {
alias: "access_key",
Expand Down