Add more options to testing setup

Ability to retrieve the logger from contract deployment, as well as
override the default `embark.json`
This commit is contained in:
DeviateFish 2017-02-26 14:33:14 -08:00
parent a153859caf
commit 5cf9048099
1 changed files with 11 additions and 6 deletions

View File

@ -11,9 +11,9 @@ var Config = require('./config.js');
var RunCode = require('./runCode.js');
var TestLogger = require('./test_logger.js');
var Test = function(_options) {
var options = _options || {};
var simOptions = options.simulatorOptions || {};
var Test = function(options) {
this.options = _options || {};
var simOptions = this.options.simulatorOptions || {};
try {
this.sim = require('ethereumjs-testrpc');
@ -39,12 +39,14 @@ var Test = function(_options) {
Test.prototype.deployAll = function(contractsConfig, cb) {
var self = this;
var logger = new TestLogger({logLevel: 'debug'});
var logger = new TestLogger({logLevel: this.options.logLevel || 'debug'});
async.waterfall([
function getConfig(callback) {
var config = new Config({env: 'test', logger: logger});
config.loadConfigFiles({embarkConfig: 'embark.json', interceptLogs: false});
config.loadConfigFiles({
interceptLogs: false
});
config.contractsConfig = {contracts: contractsConfig};
callback(null, config);
},
@ -86,7 +88,10 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
}
self.web3.eth.defaultAccount = accounts[0];
RunCode.doEval(result, self.web3); // jshint ignore:line
cb();
cb(logger);
} else {
cb();
}
});
});
};