diff --git a/lib/core/engine.js b/lib/core/engine.js index cdccb309a..c6857095f 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -167,7 +167,7 @@ class Engine { this.registerModule('solidity', {ipc: self.ipc, useDashboard: this.useDashboard}); this.registerModule('vyper'); this.registerModule('profiler'); - this.registerModule('deploytracker'); + this.registerModule('deploytracker', {trackContracts: options.trackContracts}); this.registerModule('specialconfigs'); this.registerModule('console_listener', {ipc: self.ipc}); this.registerModule('contracts_manager'); diff --git a/lib/modules/contracts_manager/index.js b/lib/modules/contracts_manager/index.js index 8f2d54afb..cde53b810 100644 --- a/lib/modules/contracts_manager/index.js +++ b/lib/modules/contracts_manager/index.js @@ -7,7 +7,7 @@ let utils = require('../../utils/utils.js'); // TODO: create a contract object class ContractsManager { - constructor(embark) { + constructor(embark, options) { const self = this; this.logger = embark.logger; this.events = embark.events; @@ -16,6 +16,7 @@ class ContractsManager { this.contractDependencies = {}; this.deployOnlyOnConfig = false; this.compileError = false; + this.compileOnceOnly = options.compileOnceOnly; self.events.setCommandHandler('contracts:list', (cb) => { cb(self.compileError, self.listContracts()); @@ -77,7 +78,7 @@ class ContractsManager { }, function compileContracts(callback) { self.events.emit("status", __("Compiling...")); - if (process.env.isTest && self.compiledContracts && Object.keys(self.compiledContracts).length) { + if (self.compileOnceOnly && self.compiledContracts && Object.keys(self.compiledContracts).length) { // Only compile once for tests return callback(); } diff --git a/lib/modules/deploytracker/index.js b/lib/modules/deploytracker/index.js index da74ca586..54b17aed7 100644 --- a/lib/modules/deploytracker/index.js +++ b/lib/modules/deploytracker/index.js @@ -7,6 +7,7 @@ class DeployTracker { this.logger = embark.logger; this.events = embark.events; this.embark = embark; + this.trackContracts = (options.trackContracts !== false); // TODO: unclear where it comes from this.env = options.env; @@ -26,7 +27,7 @@ class DeployTracker { }); self.embark.registerActionForEvent("deploy:contract:shouldDeploy", (params, cb) => { - if (process.env.isTest) { + if (!self.trackContracts) { return cb(params); } diff --git a/lib/tests/run_tests.js b/lib/tests/run_tests.js index 97af4f24f..febb06be1 100644 --- a/lib/tests/run_tests.js +++ b/lib/tests/run_tests.js @@ -24,7 +24,6 @@ function getFilesFromDir(filePath, cb) { module.exports = { run: function (options) { - process.env.isTest = true; let failures = 0; let filePath = options.file; const loglevel = options.loglevel || 'warn'; diff --git a/lib/tests/test.js b/lib/tests/test.js index 2bc7e133b..6646ee140 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -108,7 +108,8 @@ class Test { web3: this.web3 }); this.engine.startService("deployment", { - trackContracts: false + trackContracts: false, + compileOnceOnly: true }); this.events.request('deploy:setGasLimit', 6000000); this.engine.startService("codeCoverage");