Skip to content

Commit 542b03a

Browse files
Merge pull request #84 from japneetlambdatest/MLE-6963
path .join added and hardcoding removed
2 parents bff447a + d061ca9 commit 542b03a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

commands/generate_reports.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const build_stats = require("./utils/poller/build_stats.js");
55
const { access } = require("fs");
66
var fs = require("fs");
77
const StreamZip = require("node-stream-zip");
8+
const path = require("path");
89

910
function download_artefact(username, access_key, env, test_id, file_path) {
1011
return new Promise(function (resolve, reject) {
@@ -15,7 +16,7 @@ function download_artefact(username, access_key, env, test_id, file_path) {
1516
}
1617
let old_path = file_path;
1718
//Create an empty file
18-
file_path += "/artefacts.zip";
19+
file_path = path.join(file_path, "artefacts.zip");
1920
const stream = fs.createWriteStream(file_path);
2021
stream.end();
2122
request(
@@ -122,7 +123,11 @@ function generate_report(args) {
122123
reject("Session not found");
123124
return;
124125
}
125-
let directory = "./lambdatest-artefacts/" + args["session_id"];
126+
let directory = path.join(
127+
".",
128+
"lambdatest-artefacts",
129+
args["session_id"]
130+
);
126131
//Reject if there are no tests in sessions
127132
if (build_info["data"].length == 0) {
128133
reject("No tests in this session");
@@ -138,15 +143,12 @@ function generate_report(args) {
138143
access_key,
139144
env,
140145
build_info["data"][i]["test_id"],
141-
directory +
142-
"/" +
143-
build_info["data"][i]["browser"] +
144-
"-" +
145-
build_info["data"][i]["version"] +
146-
"-" +
147-
build_info["data"][i]["platform"] +
148-
"/" +
146+
path.join(
147+
directory,
148+
build_info["data"][i]["browser"],
149+
build_info["data"][i]["version"],
149150
build_info["data"][i]["test_id"]
151+
)
150152
)
151153
.then(function (resp) {
152154
//Files downloaded

commands/utils/archive.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function archive_project(lt_config) {
5353
"cypress/screenshots/**/*",
5454
"cypress/videos/**/*",
5555
"cypress/results/**/*",
56+
"lambdatest-artefacts/**/*",
5657
].concat(lt_config["run_settings"]["ignore_files"]);
5758
//If we have some env variables passed through cli or config file we will ignore the original file and create a new one using
5859
//the parameter appended in config file through code

0 commit comments

Comments
 (0)