mirror of https://github.com/embarklabs/embark.git
conflict in test
This commit is contained in:
parent
7a83b02db5
commit
ac9dbdd1d6
|
@ -254,7 +254,7 @@ class Engine {
|
|||
}
|
||||
|
||||
testRunnerService(options) {
|
||||
this.registerModule('tests', options);
|
||||
this.registerModule('tests', Object.assign(options, {ipc: this.ipc}));
|
||||
}
|
||||
|
||||
codeCoverageService(_options) {
|
||||
|
|
|
@ -9,10 +9,11 @@ const EmbarkSpec = require('./reporter');
|
|||
const SolcTest = require('./solc_test');
|
||||
|
||||
class TestRunner {
|
||||
constructor(embark, _options) {
|
||||
constructor(embark, options) {
|
||||
this.embark = embark;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.ipc = options.ipc;
|
||||
|
||||
this.events.setCommandHandler('tests:run', (options, callback) => {
|
||||
this.run(options, callback);
|
||||
|
@ -125,7 +126,8 @@ class TestRunner {
|
|||
async.waterfall([
|
||||
function setupGlobalNamespace(next) {
|
||||
// TODO put default config
|
||||
const test = new Test({loglevel, node: options.node, events: self.events, logger: self.logger, config: self.embark.config});
|
||||
const test = new Test({loglevel, node: options.node, events: self.events, logger: self.logger,
|
||||
config: self.embark.config, ipc: self.ipc});
|
||||
global.embark = test;
|
||||
global.assert = assert;
|
||||
global.config = test.config.bind(test);
|
||||
|
@ -202,7 +204,8 @@ class TestRunner {
|
|||
this.logger.info('Running solc tests');
|
||||
const loglevel = options.loglevel || 'warn';
|
||||
|
||||
let solcTest = new SolcTest({loglevel, node: options.node, events: this.events, logger: this.logger, config: this.embark.config});
|
||||
let solcTest = new SolcTest({loglevel, node: options.node, events: this.events, logger: this.logger,
|
||||
config: this.embark.config, ipc: self.ipc});
|
||||
global.embark = solcTest;
|
||||
async.waterfall([
|
||||
function initEngine(next) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const async = require('async');
|
||||
const AccountParser = require('../../utils/accountParser');
|
||||
const EmbarkJS = require('embarkjs');
|
||||
const utils = require('../../utils/utils');
|
||||
|
||||
class Test {
|
||||
constructor(options) {
|
||||
|
@ -8,6 +9,7 @@ class Test {
|
|||
this.simOptions = {};
|
||||
this.events = options.events;
|
||||
this.logger = options.logger;
|
||||
this.ipc = options.ipc;
|
||||
this.configObj = options.config;
|
||||
this.ready = true;
|
||||
this.firstRunConfig = true;
|
||||
|
@ -21,11 +23,30 @@ class Test {
|
|||
}
|
||||
|
||||
init(callback) {
|
||||
this.showNodeHttpWarning();
|
||||
|
||||
this.events.request('blockchain:object', (connector) => {
|
||||
this.blockchainConnector = connector;
|
||||
callback();
|
||||
if (this.options.node !== 'embark') {
|
||||
this.showNodeHttpWarning();
|
||||
return callback();
|
||||
}
|
||||
if (!this.ipc.connected) {
|
||||
this.engine.logger.error("Could not connect to Embark's IPC. Is embark running?");
|
||||
process.exit(1);
|
||||
}
|
||||
return this.connectToIpcNode(callback);
|
||||
});
|
||||
}
|
||||
|
||||
connectToIpcNode(cb) {
|
||||
this.ipc.request('blockchain:node', {}, (err, node) => {
|
||||
if (err) {
|
||||
this.logger.error(err.message || err);
|
||||
return cb();
|
||||
}
|
||||
this.options.node = node;
|
||||
this.showNodeHttpWarning();
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -42,42 +63,27 @@ class Test {
|
|||
// TODO use event for this
|
||||
if (!this.simOptions.host && (this.options.node && this.options.node === 'vm')) {
|
||||
this.simOptions.type = 'vm';
|
||||
} else if (this.simOptions.host || (this.options.node && this.options.node !== 'vm')) {
|
||||
let options = this.simOptions;
|
||||
if (this.options.node) {
|
||||
options = utils.deconstructUrl(this.options.node);
|
||||
}
|
||||
|
||||
if (!options.protocol) {
|
||||
options.protocol = (options.type === "rpc") ? 'http' : 'ws';
|
||||
}
|
||||
Object.assign(this.simOptions, options);
|
||||
}
|
||||
|
||||
this.configObj.contractsConfig.deployment = this.simOptions;
|
||||
this.blockchainConnector.contractsConfig = this.configObj.contractsConfig;
|
||||
this.blockchainConnector.isWeb3Ready = false;
|
||||
this.blockchainConnector.wait = false;
|
||||
this.blockchainConnector.coverage = this.options.coverage;
|
||||
|
||||
|
||||
this.blockchainConnector.initWeb3(callback);
|
||||
}
|
||||
|
||||
/*initDeployServices() {
|
||||
this.engine.startService("web3", {
|
||||
web3: this.web3
|
||||
});
|
||||
this.engine.startService("deployment", {
|
||||
trackContracts: false,
|
||||
compileOnceOnly: true,
|
||||
disableOptimizations: this.options.coverage
|
||||
});
|
||||
this.gasLimit = 6000000;
|
||||
this.engine.events.request('deploy:setGasLimit', this.gasLimit);
|
||||
}*/
|
||||
|
||||
/*connectToIpcNode(cb) {
|
||||
this.engine.ipc.request('blockchain:node', {}, (err, node) => {
|
||||
if (err) {
|
||||
this.engine.logger.error(err.message || err);
|
||||
return cb();
|
||||
}
|
||||
this.options.node = node;
|
||||
this.showNodeHttpWarning();
|
||||
cb();
|
||||
});
|
||||
}*/
|
||||
|
||||
showNodeHttpWarning() {
|
||||
if (this.options.node.startsWith('http')) {
|
||||
this.logger.warn("You are using http to connect to the node, as a result the gas details won't be correct." +
|
||||
|
|
Loading…
Reference in New Issue