fix reload file removing plugins

This commit is contained in:
Jonathan Rainville 2018-08-08 17:10:36 -04:00 committed by Iuri Matias
parent d0ad16004b
commit c225d97e4b
3 changed files with 5 additions and 9 deletions

View File

@ -13,10 +13,6 @@
"reset": "reset", "reset": "reset",
"any": "any" "any": "any"
}, },
"events": {
"contractFilesChanged": "contractFilesChanged",
"contractConfigChanged": "contractConfigChanged"
},
"process": { "process": {
"processLaunchRequest": "process:launch-request", "processLaunchRequest": "process:launch-request",
"processLaunchComplete": "process:launch-complete", "processLaunchComplete": "process:launch-complete",

View File

@ -222,7 +222,6 @@ Config.prototype.loadContractsConfigFile = function() {
const newContractsConfig = this._mergeConfig(configFilePath, configObject, this.env); const newContractsConfig = this._mergeConfig(configFilePath, configObject, this.env);
if (!deepEqual(newContractsConfig, this.contractsConfig)) { if (!deepEqual(newContractsConfig, this.contractsConfig)) {
this.events.emit(constants.events.contractConfigChanged, newContractsConfig);
this.contractsConfig = newContractsConfig; this.contractsConfig = newContractsConfig;
} }
}; };
@ -333,8 +332,11 @@ Config.prototype.loadEmbarkConfigFile = function() {
const contracts = this.embarkConfig.contracts; const contracts = this.embarkConfig.contracts;
const newContractsFiles = this.loadFiles(contracts); const newContractsFiles = this.loadFiles(contracts);
if (!this.contractFiles || newContractsFiles.length !== this.contractFiles.length || !deepEqual(newContractsFiles, this.contractFiles)) { if (!this.contractFiles || newContractsFiles.length !== this.contractFiles.length || !deepEqual(newContractsFiles, this.contractFiles)) {
this.events.emit(constants.events.contractFilesChanged, newContractsFiles); this.contractsFiles = this.contractsFiles.concat(newContractsFiles).filter((file, index, arr) => {
this.contractsFiles = newContractsFiles; return !arr.some((file2, index2) => {
return file.filename === file2.filename && index < index2;
});
});
} }
// determine contract 'root' directories // determine contract 'root' directories
this.contractDirectories = contracts.map((dir) => { this.contractDirectories = contracts.map((dir) => {

View File

@ -2,7 +2,6 @@ const async = require('async');
const Engine = require('../core/engine.js'); const Engine = require('../core/engine.js');
const TestLogger = require('./test_logger.js'); const TestLogger = require('./test_logger.js');
const Web3 = require('web3'); const Web3 = require('web3');
const constants = require('../constants');
const Events = require('../core/events'); const Events = require('../core/events');
const AccountParser = require('../utils/accountParser'); const AccountParser = require('../utils/accountParser');
// TODO: breaks module isolation; tests need to be refactored to use the engine and avoid this // TODO: breaks module isolation; tests need to be refactored to use the engine and avoid this
@ -272,7 +271,6 @@ class Test {
async.waterfall([ async.waterfall([
function getConfig(next) { function getConfig(next) {
self.engine.config.contractsConfig = {contracts: config.contracts, versions: self.versions_default}; self.engine.config.contractsConfig = {contracts: config.contracts, versions: self.versions_default};
self.engine.events.emit(constants.events.contractConfigChanged, self.engine.config.contractsConfig);
next(); next();
}, },
function getAccounts(next) { function getAccounts(next) {