Skip to content

Commit 195303f

Browse files
committed
feat(mock.ts, keploy.ts, client.ts): adding Keploy Mode in logs to notify user
Adding Keploy mode in logs to notify user in which mode keploy is running whether it is record, test, off feat #45
1 parent 88691f5 commit 195303f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

mock/mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ export function NewContext(conf: Config) {
3636
} catch (err) {
3737
console.log("Failed to get the path of current directory");
3838
console.log(err);
39+
console.log("Keploy mode:",process.env.KEPLOY_MODE)
3940
}
4041
} else if (path[0] !== "/") {
4142
try {
4243
path = resolve(conf.Path);
4344
} catch (err) {
4445
console.log("Failed to get the absolute path from relative conf.path");
4546
console.log(err);
47+
console.log("Keploy mode:",process.env.KEPLOY_MODE)
4648
}
4749
}
4850
path += "/mocks";

src/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default class HttpClient {
142142
await http(options);
143143
} catch (error) {
144144
console.log(error);
145+
console.log("Keploy mode:",process.env.KEPLOY_MODE);
145146
}
146147
}
147148
}

src/keploy.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default class Keploy {
132132

133133
async runTests() {
134134
if (process.env.KEPLOY_MODE == "test") {
135-
console.log("test starting in " + this.appConfig.delay + "s");
135+
console.log("test starting in " + this.appConfig.delay + "s" + " KEPLOY_MODE: " + process.env.KEPLOY_MODE );
136136
setTimeout(async () => {
137137
await this.test();
138138
}, this.appConfig.delay * 1000);
@@ -241,6 +241,8 @@ export default class Keploy {
241241
testId,
242242
" }, { total tests: ",
243243
totalTests,
244+
" },{ Keploy mode:",
245+
process.env.KEPLOY_MODE,
244246
" }"
245247
);
246248
let pass = true;
@@ -276,8 +278,10 @@ export default class Keploy {
276278
if (err !== null) {
277279
console.error(
278280
"failed to call test method of keploy. error: ",
279-
err
280-
);
281+
err,
282+
"Keploy mode:",
283+
process.env.KEPLOY_MODE,
284+
);
281285
}
282286

283287
if (response?.pass?.pass === false) {

0 commit comments

Comments
 (0)