diff --git a/buidler.config.js b/buidler.config.js index a7d4278b7..bf28eeedb 100644 --- a/buidler.config.js +++ b/buidler.config.js @@ -1,15 +1,12 @@ +const fs = require('fs'); +const path = require('path'); + usePlugin('solidity-coverage'); usePlugin('@nomiclabs/buidler-truffle5'); -extendEnvironment(env => { - const { contract } = env; - env.contract = function (name, body) { - // remove the default account from the accounts list used in tests, in order - // to protect tests against accidentally passing due to the contract - // deployer being used subsequently as function caller - contract(name, accounts => body(accounts.slice(1))); - }; -}); +for (const f of fs.readdirSync(path.join(__dirname, 'buidler'))) { + require(path.join(__dirname, 'buidler', f)); +} module.exports = { networks: { diff --git a/buidler/env-contract.js b/buidler/env-contract.js new file mode 100644 index 000000000..74d54cfbb --- /dev/null +++ b/buidler/env-contract.js @@ -0,0 +1,10 @@ +extendEnvironment(env => { + const { contract } = env; + + env.contract = function (name, body) { + // remove the default account from the accounts list used in tests, in order + // to protect tests against accidentally passing due to the contract + // deployer being used subsequently as function caller + contract(name, accounts => body(accounts.slice(1))); + }; +});