fix(@embark/test-runenr): fix event listener overflow

This commit is contained in:
Jonathan Rainville 2019-06-14 17:18:25 -04:00
parent 09d7428e7e
commit e288483661

View File

@ -199,6 +199,16 @@ class Test {
self.ready = false;
async.waterfall([
function cleanContracts(next) {
Object.keys(self.contracts).forEach(contractName => {
if (self.contracts[contractName]._requestManager) {
// Remove all data listeners from the contract provider as a listener for `data` is added for each new contract
// Removing directly as contract.removeSubscriptions throws errors and doesn't really unsubscribe
self.contracts[contractName]._requestManager.provider.removeAllListeners('data');
}
});
next();
},
function checkDeploymentOpts(next) {
self.checkDeploymentOptions(options, next);
},