Skip to content

Commit 3064001

Browse files
Japneet Singh ChawlaJapneet Singh Chawla
authored andcommitted
Reporter.json validations added and status cod epassed added to eof flag
1 parent e1407ec commit 3064001

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

commands/utils/poller/poller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ function poll_build(lt_config, session_id, env) {
4141
console.log(stats);
4242
if (
4343
Object.keys(stats).length == 1 &&
44-
Object.keys(stats).includes("completed")
44+
(Object.keys(stats).includes("completed") ||
45+
Object.keys(stats).includes("passed"))
4546
) {
4647
resolve(0);
4748
} else {

commands/utils/validate.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,34 @@ module.exports = validate_config = function (lt_config, validation_configs) {
208208
reject("Smart UI porject name can not be blank");
209209
}
210210
}
211+
//validate if reporter json file is passed and exists
212+
if (
213+
lt_config["run_settings"]["reporter_config_file"] &&
214+
lt_config["run_settings"]["reporter_config_file"] != ""
215+
) {
216+
if (!fs.existsSync(lt_config["run_settings"]["reporter_config_file"])) {
217+
reject(
218+
"Error!! Reporter Json File does not exist, either remove the key reporter_config_file or pass a valid path"
219+
);
220+
} else {
221+
let rawdata = fs.readFileSync(
222+
lt_config["run_settings"]["reporter_config_file"]
223+
);
224+
try {
225+
let reporter_config = JSON.parse(rawdata);
226+
if (Object.keys(reporter_config).length == 0) {
227+
reject(
228+
"Error!! Reporter JSON File has no keys, either remove Key reporter_config_file from lambdatest config or pass some options"
229+
);
230+
}
231+
} catch {
232+
console.log(
233+
"reporter_config_file is not parsed, please provide a valid json in Reporter Config"
234+
);
235+
reject("Error!! Reporter JSON File does not has correct json");
236+
}
237+
}
238+
}
211239
resolve("Validated the Config");
212240
});
213241
};

0 commit comments

Comments
 (0)