mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-10 14:16:47 +00:00
conflict in test
This commit is contained in:
parent
7a83b02db5
commit
ac9dbdd1d6
@ -254,7 +254,7 @@ class Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testRunnerService(options) {
|
testRunnerService(options) {
|
||||||
this.registerModule('tests', options);
|
this.registerModule('tests', Object.assign(options, {ipc: this.ipc}));
|
||||||
}
|
}
|
||||||
|
|
||||||
codeCoverageService(_options) {
|
codeCoverageService(_options) {
|
||||||
|
@ -9,10 +9,11 @@ const EmbarkSpec = require('./reporter');
|
|||||||
const SolcTest = require('./solc_test');
|
const SolcTest = require('./solc_test');
|
||||||
|
|
||||||
class TestRunner {
|
class TestRunner {
|
||||||
constructor(embark, _options) {
|
constructor(embark, options) {
|
||||||
this.embark = embark;
|
this.embark = embark;
|
||||||
this.logger = embark.logger;
|
this.logger = embark.logger;
|
||||||
this.events = embark.events;
|
this.events = embark.events;
|
||||||
|
this.ipc = options.ipc;
|
||||||
|
|
||||||
this.events.setCommandHandler('tests:run', (options, callback) => {
|
this.events.setCommandHandler('tests:run', (options, callback) => {
|
||||||
this.run(options, callback);
|
this.run(options, callback);
|
||||||
@ -125,7 +126,8 @@ class TestRunner {
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
function setupGlobalNamespace(next) {
|
function setupGlobalNamespace(next) {
|
||||||
// TODO put default config
|
// 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.embark = test;
|
||||||
global.assert = assert;
|
global.assert = assert;
|
||||||
global.config = test.config.bind(test);
|
global.config = test.config.bind(test);
|
||||||
@ -202,7 +204,8 @@ class TestRunner {
|
|||||||
this.logger.info('Running solc tests');
|
this.logger.info('Running solc tests');
|
||||||
const loglevel = options.loglevel || 'warn';
|
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;
|
global.embark = solcTest;
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function initEngine(next) {
|
function initEngine(next) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const async = require('async');
|
const async = require('async');
|
||||||
const AccountParser = require('../../utils/accountParser');
|
const AccountParser = require('../../utils/accountParser');
|
||||||
const EmbarkJS = require('embarkjs');
|
const EmbarkJS = require('embarkjs');
|
||||||
|
const utils = require('../../utils/utils');
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
@ -8,6 +9,7 @@ class Test {
|
|||||||
this.simOptions = {};
|
this.simOptions = {};
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
this.logger = options.logger;
|
this.logger = options.logger;
|
||||||
|
this.ipc = options.ipc;
|
||||||
this.configObj = options.config;
|
this.configObj = options.config;
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
this.firstRunConfig = true;
|
this.firstRunConfig = true;
|
||||||
@ -21,11 +23,30 @@ class Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(callback) {
|
init(callback) {
|
||||||
this.showNodeHttpWarning();
|
|
||||||
|
|
||||||
this.events.request('blockchain:object', (connector) => {
|
this.events.request('blockchain:object', (connector) => {
|
||||||
this.blockchainConnector = 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
|
// TODO use event for this
|
||||||
if (!this.simOptions.host && (this.options.node && this.options.node === 'vm')) {
|
if (!this.simOptions.host && (this.options.node && this.options.node === 'vm')) {
|
||||||
this.simOptions.type = '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.configObj.contractsConfig.deployment = this.simOptions;
|
||||||
this.blockchainConnector.contractsConfig = this.configObj.contractsConfig;
|
this.blockchainConnector.contractsConfig = this.configObj.contractsConfig;
|
||||||
this.blockchainConnector.isWeb3Ready = false;
|
this.blockchainConnector.isWeb3Ready = false;
|
||||||
this.blockchainConnector.wait = false;
|
this.blockchainConnector.wait = false;
|
||||||
this.blockchainConnector.coverage = this.options.coverage;
|
this.blockchainConnector.coverage = this.options.coverage;
|
||||||
|
|
||||||
|
|
||||||
this.blockchainConnector.initWeb3(callback);
|
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() {
|
showNodeHttpWarning() {
|
||||||
if (this.options.node.startsWith('http')) {
|
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." +
|
this.logger.warn("You are using http to connect to the node, as a result the gas details won't be correct." +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user