chore(@embark/proxy): suppress error logs when inside test-runner context

When running tests that expect the EVM to fail, Embark's proxy keeps logging
the VM errors to stdout making it look like tests weren't successful, while they
are actually passing.

Inside a test-runner it's probably expected not to see any error logs when the
tests in question expect errors.

This commit changes the proxy to use `debug()` logs instead of `error()`, making
it configurable through log verbosity how much errors are seen.
This commit is contained in:
Pascal Precht 2020-01-03 12:02:22 +01:00 committed by Iuri Matias
parent 5843a8e03e
commit 6797a8a9fc
2 changed files with 3 additions and 3 deletions

View File

@ -128,7 +128,7 @@ export default class ProxyManager {
isWs: false,
logger: this.logger,
plugins: this.plugins,
isVm: this.isVm
isVm: this.isVm,
})
.serve(
this.host,
@ -143,7 +143,7 @@ export default class ProxyManager {
isWs: true,
logger: this.logger,
plugins: this.plugins,
isVm: this.isVm
isVm: this.isVm,
})
.serve(
this.host,

View File

@ -152,7 +152,7 @@ export class Proxy {
if (modifiedResp && modifiedResp.response && modifiedResp.response.error) {
// error returned from the node and it wasn't stripped by our response actions
const error = modifiedResp.response.error.message || modifiedResp.response.error;
this.logger.error(__(`Error returned from the node: ${error}`));
this.logger.debug(__(`Error returned from the node: ${error}`));
const rpcErrorObj = { "jsonrpc": "2.0", "error": { "code": -32603, "message": error }, "id": modifiedResp.response.id };
return this.respondError(transport, rpcErrorObj);
}