diff --git a/cmd/cmd_controller.js b/cmd/cmd_controller.js index e9ac99472..2cb254164 100644 --- a/cmd/cmd_controller.js +++ b/cmd/cmd_controller.js @@ -537,16 +537,14 @@ class EmbarkController { client: options.client, locale: options.locale, version: this.version, - embarkConfig: 'embark.json', - interceptLogs: false, + embarkConfig: options.embarkConfig || 'embark.json', logFile: options.logFile, logLevel: options.logLevel, - events: options.events, - logger: options.logger, - config: options.config, - plugins: options.plugins, context: this.context, - webpackConfigName: options.webpackConfigName + useDashboard: options.useDashboard, + webpackConfigName: options.webpackConfigName, + ipcRole: 'client', + interceptLogs: false }); async.waterfall([ @@ -555,8 +553,10 @@ class EmbarkController { }, function startServices(callback) { engine.startService("processManager"); + engine.startService("libraryManager"); engine.startService("web3", {wait: true}); // Empty web3 as Test changes it engine.startService("deployment"); + engine.startService("codeGenerator"); engine.startService("testRunner"); callback(); }, diff --git a/lib/core/config.js b/lib/core/config.js index eb1486d19..f015f5436 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -13,7 +13,7 @@ const unitRegex = /([0-9]+) ([a-zA-Z]+)/; var Config = function(options) { const self = this; - this.env = options.env; + this.env = options.env || 'default'; this.blockchainConfig = {}; this.contractsConfig = {}; this.pipelineConfig = {}; diff --git a/lib/modules/blockchain_connector/index.js b/lib/modules/blockchain_connector/index.js index a9e129abc..99f949b31 100644 --- a/lib/modules/blockchain_connector/index.js +++ b/lib/modules/blockchain_connector/index.js @@ -67,9 +67,11 @@ class BlockchainConnector { } if (type === 'vm') { - this.provider = this._getSimulator().provider; - this.web3.setProvider(this.provider(this.contractsConfig.deployment)); - return self._emitWeb3Ready(); + const sim = this._getSimulator(); + this.provider = sim.provider(this.contractsConfig.deployment); + this.web3.setProvider(this.provider); + this._emitWeb3Ready(); + return cb(); } protocol = (type === "rpc") ? protocol : 'ws'; diff --git a/lib/modules/solidity/index.js b/lib/modules/solidity/index.js index d18c1389b..7459b996d 100644 --- a/lib/modules/solidity/index.js +++ b/lib/modules/solidity/index.js @@ -55,7 +55,6 @@ class Solidity { self.logger.info(__("loading solc compiler") + ".."); self.solcW.load_compiler(function (err) { - console.log('LOADED'); self.solcAlreadyLoaded = true; callback(err); }); @@ -147,7 +146,6 @@ class Solidity { callback(null, compiled_object); } ], function (err, result) { - console.log('COMPLETED COMPILATION', err); cb(err, result); }); } diff --git a/lib/modules/solidity/solcP.js b/lib/modules/solidity/solcP.js index caf34484a..43de66b81 100644 --- a/lib/modules/solidity/solcP.js +++ b/lib/modules/solidity/solcP.js @@ -10,7 +10,6 @@ const NpmTimer = require('../library_manager/npmTimer'); class SolcProcess extends ProcessWrapper { constructor(options){ - console.error('ALLO'); super({pingParent: false}); this._logger = options.logger; this._showSpinner = options.showSpinner === true; @@ -67,7 +66,6 @@ class SolcProcess extends ProcessWrapper { let solcProcess; process.on('message', (msg) => { - console.error('MSG', msg.action); if (msg.action === "init") { solcProcess = new SolcProcess(msg.options); return process.send({result: "initiated"}); diff --git a/lib/modules/solidity/solcW.js b/lib/modules/solidity/solcW.js index 07e4daa07..d4ea8122b 100644 --- a/lib/modules/solidity/solcW.js +++ b/lib/modules/solidity/solcW.js @@ -45,7 +45,6 @@ class SolcW { events: self.events, silent: false }); - console.log(utils.joinPath(__dirname, 'solcP.js')); this.solcProcess.once("result", "initiated", () => { this.events.request("version:get:solc", function(solcVersion) { diff --git a/lib/modules/tests/index.js b/lib/modules/tests/index.js index 407589c55..27ed1d3e8 100644 --- a/lib/modules/tests/index.js +++ b/lib/modules/tests/index.js @@ -64,7 +64,7 @@ class TestRunner { if (err) { return next(err); } - console.log(`Coverage report created. You can find it here: ${fs.dappPath('coverage/__root__/index.html')}\n`); + self.logger.info(`Coverage report created. You can find it here: ${fs.dappPath('coverage/__root__/index.html')}\n`); const opn = require('opn'); const _next = () => { next(null, results); }; if (options.noBrowser) { @@ -78,14 +78,14 @@ class TestRunner { } ], (err, results) => { if (err) { - console.error(err); + self.logger.error(err); return cb(err); } let totalFailures = results.reduce((acc, result) => acc + result.failures, 0); if (totalFailures) { return cb(` > Total number of failures: ${totalFailures}`.red.bold); } - console.log(' > All tests passed'.green.bold); + self.logger.info(' > All tests passed'.green.bold); cb(); }); } @@ -131,8 +131,8 @@ class TestRunner { global.config = test.config.bind(test); let deprecatedWarning = function () { - console.error(__('%s are not supported anymore', 'EmbarkSpec & deployAll').red); - console.info(__('You can learn about the new revamped tests here: %s', 'https://embark.status.im/docs/testing.html'.underline)); + self.logger.error(__('%s are not supported anymore', 'EmbarkSpec & deployAll').red); + self.logger.info(__('You can learn about the new revamped tests here: %s', 'https://embark.status.im/docs/testing.html'.underline)); process.exit(); }; @@ -199,7 +199,7 @@ class TestRunner { } runSolidityTests(files, options, cb) { - console.log('Running solc tests'); + self.logger.info('Running solc tests'); const loglevel = options.loglevel || 'warn'; let solcTest = new SolcTest({loglevel, node: options.node}); global.embark = solcTest; diff --git a/lib/modules/tests/test.js b/lib/modules/tests/test.js index 6eb1cbb1a..f82026d0a 100644 --- a/lib/modules/tests/test.js +++ b/lib/modules/tests/test.js @@ -101,6 +101,7 @@ class Test { this.configObj.contractsConfig.deployment = this.simOptions; this.blockchainConnector.contractsConfig = this.configObj.contractsConfig; this.blockchainConnector.isWeb3Ready = false; + this.blockchainConnector.wait = false; // TODO change this if (this.simOptions.host || (this.options.node && this.options.node !== 'vm')) { @@ -123,11 +124,11 @@ class Test { isDev: false, web3Endpoint: endpoint }; - console.info(`Connecting to node at ${endpoint}`.cyan); + self.logger.info(`Connecting to node at ${endpoint}`.cyan); return utils.pingEndpoint(host, port, type, protocol, this.configObj.blockchainConfig.wsOrigins.split(',')[0], (err) => { if (err) { - console.error(`Error connecting to the node, there might be an error in ${endpoint}`.red); + self.logger.error(`Error connecting to the node, there might be an error in ${endpoint}`.red); return callback(err); } @@ -303,6 +304,12 @@ class Test { function checkDeploymentOpts(next) { self.checkDeploymentOptions(options, next); }, + function updateWeb3(next) { + self.events.request("blockchain:get", function(web3) { + self.web3 = web3; + next(); + }); + }, function compileContracts(next) { if (!self.firstDeployment) { return next(); @@ -407,7 +414,8 @@ class Test { } ], function (err, accounts) { if (err) { - self.logger.log(__('terminating due to error')); + self.logger.error(__('terminating due to error')); + self.logger.error(err.message || err); return callback(err); } callback(null, accounts);