fix(test/blockchain): fix race condition of installing web3 and test

This commit is contained in:
Jonathan Rainville 2019-02-12 09:02:17 -05:00 committed by Iuri Matias
parent 976f9944a8
commit 8ebba404e2
5 changed files with 25 additions and 12 deletions

View File

@ -34,15 +34,17 @@ class Test {
init(callback) {
this.gasLimit = constants.tests.gasLimit;
this.events.request('deploy:setGasLimit', this.gasLimit);
if (this.options.node !== 'embark') {
this.showNodeHttpWarning();
return callback();
}
if (!this.ipc.connected) {
this.logger.error("Could not connect to Embark's IPC. Is embark running?");
if (!this.options.inProcess) process.exit(1);
}
return this.connectToIpcNode(callback);
this.events.request('blockchain:connector:ready', () => {
if (this.options.node !== 'embark') {
this.showNodeHttpWarning();
return callback();
}
if (!this.ipc.connected) {
this.logger.error("Could not connect to Embark's IPC. Is embark running?");
if (!this.options.inProcess) process.exit(1);
}
this.connectToIpcNode(callback);
});
}
connectToIpcNode(cb) {

View File

@ -44,5 +44,11 @@ module.exports = (embark) => {
embark.addConsoleProviderInit('blockchain', code, shouldInit);
});
embark.events.setCommandHandler('blockchain:connector:ready', (cb) => {
pathPromise.then((_web3Location) => {
cb();
});
});
});
};

View File

@ -1,7 +1,6 @@
{
"default": {
"versions": {
"web3": "1.0.0-beta.27",
"solc": "0.4.24"
},
"deployment": {

View File

@ -1,5 +1,7 @@
{
"contracts": ["contracts/**"],
"contracts": [
"contracts/**"
],
"app": {},
"buildDir": "build/",
"config": {
@ -12,5 +14,8 @@
"versions": {
"web3": "1.0.0-beta",
"solc": "0.4.24"
},
"plugins": {
"web3Connector": {}
}
}

View File

@ -1,7 +1,8 @@
{
"devDependencies": {
"embark": "4.0.0-beta.0",
"rimraf": "2.6.3"
"rimraf": "2.6.3",
"web3Connector": "file:../../../packages/web3Connector"
},
"name": "contracts_app",
"private": true,