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

View File

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

View File

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

View File

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

View File

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