Merge pull request #575 from embark-framework/bug_fix/stop-test-provider

stop provider when resetting providers
This commit is contained in:
RJ Catalano 2018-06-22 13:13:56 -05:00 committed by GitHub
commit b78971147b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -44,6 +44,9 @@ class Test {
}
initWeb3Provider(callback) {
if (this.provider) {
this.provider.stop();
}
if (this.simOptions.host) {
let {host, port, type, protocol, accounts} = this.simOptions;
if (!protocol) {
@ -75,7 +78,9 @@ class Test {
return {balance: account.hexBalance, secretKey: account.privateKey};
});
}
this.sim = getSimulator();
if (!this.sim) {
this.sim = getSimulator();
}
this.web3.setProvider(this.sim.provider(this.simOptions));
callback();
}