Skip to content

Commit

Permalink
feat(keploy.ts, mock.ts): adding log in Keploy.ts and mock.ts
Browse files Browse the repository at this point in the history
feat #45
  • Loading branch information
Hermione2408 committed Mar 1, 2023
1 parent 195303f commit 0085783
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions mock/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface Config {
Mode: string;
}
export function NewContext(conf: Config) {
console.log("Keploy running in: ",process.env.KEPLOY_MODE," mode");
let mode = MODE_TEST,
path = conf !== undefined && conf.Path !== undefined ? conf.Path : "";

Expand All @@ -36,15 +37,13 @@ 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: 0 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export default class HttpClient {
await http(options);
} catch (error) {
console.log(error);
console.log("Keploy mode:",process.env.KEPLOY_MODE);
}
}
}
9 changes: 3 additions & 6 deletions src/keploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default class Keploy {
this.responses = {};
this.dependencies = {};
this.mocks = {};
console.log("Keploy running in: ",process.env.KEPLOY_MODE," mode");
}

validateServerConfig({
Expand Down Expand Up @@ -132,7 +133,7 @@ export default class Keploy {

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

Expand Down

0 comments on commit 0085783

Please sign in to comment.