Skip to content

Commit

Permalink
feat(mock.ts, keploy.ts, client.ts): adding Keploy Mode in logs to no…
Browse files Browse the repository at this point in the history
…tify user

Adding Keploy mode in logs to notify user in which mode keploy is running whether it is record,
test, off

feat #45
  • Loading branch information
Hermione2408 committed Feb 25, 2023
1 parent 88691f5 commit 195303f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mock/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export function NewContext(conf: Config) {
} catch (err) {
console.log("Failed to get the path of current directory");
console.log(err);
console.log("Keploy mode:",process.env.KEPLOY_MODE)
}
} else if (path[0] !== "/") {
try {
path = resolve(conf.Path);
} catch (err) {
console.log("Failed to get the absolute path from relative conf.path");
console.log(err);
console.log("Keploy mode:",process.env.KEPLOY_MODE)
}
}
path += "/mocks";
Expand Down
1 change: 1 addition & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export default class HttpClient {
await http(options);
} catch (error) {
console.log(error);
console.log("Keploy mode:",process.env.KEPLOY_MODE);
}
}
}
10 changes: 7 additions & 3 deletions src/keploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class Keploy {

async runTests() {
if (process.env.KEPLOY_MODE == "test") {
console.log("test starting in " + this.appConfig.delay + "s");
console.log("test starting in " + this.appConfig.delay + "s" + " KEPLOY_MODE: " + process.env.KEPLOY_MODE );
setTimeout(async () => {
await this.test();
}, this.appConfig.delay * 1000);
Expand Down Expand Up @@ -241,6 +241,8 @@ export default class Keploy {
testId,
" }, { total tests: ",
totalTests,
" },{ Keploy mode:",
process.env.KEPLOY_MODE,
" }"
);
let pass = true;
Expand Down Expand Up @@ -276,8 +278,10 @@ export default class Keploy {
if (err !== null) {
console.error(
"failed to call test method of keploy. error: ",
err
);
err,
"Keploy mode:",
process.env.KEPLOY_MODE,
);
}

if (response?.pass?.pass === false) {
Expand Down

0 comments on commit 195303f

Please sign in to comment.