diff --git a/.solcover.js b/.solcover.js index 706360613..fbce551ac 100644 --- a/.solcover.js +++ b/.solcover.js @@ -1,14 +1,11 @@ -const skipFiles = [ - 'lib', - 'test', - 'acl/ACLSyntaxSugar.sol', - 'common/DepositableStorage.sol', // Used in tests that send ETH - 'common/UnstructuredStorage.sol' // Used in tests that send ETH -] - module.exports = { - norpc: true, - compileCommand: '../node_modules/.bin/truffle compile', - testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage', - skipFiles, + skipFiles: [ + 'lib', + 'test', + 'acl/ACLSyntaxSugar.sol', + ], + mocha: { + grep: '@skip-on-coverage', // Find everything with this tag + invert: true // Run the grep's inverse set. + } } diff --git a/package.json b/package.json index d58aaa0c1..364df6c94 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "test:gas": "GAS_REPORTER=true npm test", "test:gas:ci": "yarn test:gas && npx codechecks", "test:ganache-cli": "./node_modules/@aragon/contract-helpers-test/scripts/ganache-cli.sh", - "coverage": "SOLIDITY_COVERAGE=true yarn test:ganache-cli", + "coverage": "npx truffle run coverage", "abi:extract": "truffle-extract --output abi/ --keys abi", "bytecode:extract": "truffle-bytecode extract -o bytecode", "bytecode:extract:new": "truffle-bytecode extract -o bytecode_new", diff --git a/test/contracts/acl/acl_params.js b/test/contracts/acl/acl_params.js index ebe9b0e9d..274ef187f 100644 --- a/test/contracts/acl/acl_params.js +++ b/test/contracts/acl/acl_params.js @@ -1,5 +1,4 @@ const { assertRevert } = require('@aragon/contract-helpers-test/src/asserts') -const { skipSuiteCoverage } = require('../../helpers/coverage') const { permissionParamEqOracle } = require('../../helpers/permissionParams') const ACL = artifacts.require('ACL') @@ -118,7 +117,7 @@ contract('ACL params', ([permissionsRoot, specificEntity, noPermission, mockAppA ['asserts', AssertOracle], ['uses all available gas', OverGasLimitOracle], ]) { - skipSuiteCoverage(describe)(`when the oracle ${description}`, () => { + describe(`when the oracle ${description} [@skip-on-coverage]`, () => { let overGasLimitOracle before(async () => { diff --git a/test/contracts/apps/recovery_to_vault.js b/test/contracts/apps/recovery_to_vault.js index 768cfe0c0..c1e38f902 100644 --- a/test/contracts/apps/recovery_to_vault.js +++ b/test/contracts/apps/recovery_to_vault.js @@ -241,9 +241,9 @@ contract('Recovery to vault', ([permissionsRoot]) => { await assertRevert(target.sendTransaction({ value: 1, data: '0x01', gas: SEND_ETH_GAS })) }) - it('recovers ETH', async () => + it('recovers ETH [@skip-on-coverage]', async () => { await recoverEth({ target, vault }) - ) + }) for (const { title, tokenContract } of tokenTestGroups) { it(`recovers ${title}`, async () => { @@ -334,7 +334,7 @@ contract('Recovery to vault', ([permissionsRoot]) => { await kernel.setRecoveryVaultAppId(vaultId) }) - it('recovers ETH from the kernel', async () => { + it('recovers ETH from the kernel [@skip-on-coverage]', async () => { await recoverEth({ target: kernel, vault }) }) }) diff --git a/test/contracts/common/depositable_delegate_proxy.js b/test/contracts/common/depositable_delegate_proxy.js index 8edd889ad..8b293ac97 100644 --- a/test/contracts/common/depositable_delegate_proxy.js +++ b/test/contracts/common/depositable_delegate_proxy.js @@ -1,4 +1,3 @@ -const { skipCoverage } = require('../../helpers/coverage') const { bn } = require('@aragon/contract-helpers-test') const { assertAmountOfEvents, assertEvent, assertRevert, assertOutOfGas, assertBn } = require('@aragon/contract-helpers-test/src/asserts') @@ -11,7 +10,7 @@ const ProxyTargetWithFallback = artifacts.require('ProxyTargetWithFallback') const TX_BASE_GAS = 21000 const SEND_ETH_GAS = TX_BASE_GAS + 9999 // <10k gas is the threshold for depositing const PROXY_FORWARD_GAS = TX_BASE_GAS + 2e6 // high gas amount to ensure that the proxy forwards the call -const FALLBACK_SETUP_GAS = process.env.SOLIDITY_COVERAGE ? 5000 : 100 // rough estimation of how much gas it spends before executing the fallback code +const FALLBACK_SETUP_GAS = 100 // rough estimation of how much gas it spends before executing the fallback code const SOLIDITY_TRANSFER_GAS = 2300 contract('DepositableDelegateProxy', ([ sender ]) => { @@ -45,7 +44,7 @@ contract('DepositableDelegateProxy', ([ sender ]) => { itSuccessfullyForwardsCall() - it('can receive ETH', async () => { + it('can receive ETH [@skip-on-coverage]', async () => { const receipt = await target.sendTransaction({ value: 1, gas: SEND_ETH_GAS + FALLBACK_SETUP_GAS }) assertAmountOfEvents(receipt, 'ReceivedEth') }) @@ -115,22 +114,17 @@ contract('DepositableDelegateProxy', ([ sender ]) => { } it('can receive ETH', async () => { - const { gasUsed } = await assertSendEthToProxy({ value, gas: SEND_ETH_GAS }) + await assertSendEthToProxy({ value, gas: SEND_ETH_GAS }) }) - it( - 'cannot receive ETH if sent with a small amount of gas', - // Our version of solidity-coverage is not on an istanbul context yet - // TODO: update solidity-coverage - skipCoverage(async () => { - const oogDecrease = 250 - // deposit cannot be done with this amount of gas - const gas = TX_BASE_GAS + SOLIDITY_TRANSFER_GAS - oogDecrease - await assertSendEthToProxy({ shouldOOG: true, value, gas }) - }) - ) + it('cannot receive ETH if sent with a small amount of gas [@skip-on-coverage]', async () => { + const oogDecrease = 250 + // deposit cannot be done with this amount of gas + const gas = TX_BASE_GAS + SOLIDITY_TRANSFER_GAS - oogDecrease + await assertSendEthToProxy({ shouldOOG: true, value, gas }) + }) - it('can receive ETH from contract', async () => { + it('can receive ETH from contract [@skip-on-coverage]', async () => { const receipt = await ethSender.sendEth(proxy.address, { value }) assertAmountOfEvents(receipt, 'ProxyDeposit', { decodeForAbi: proxy.abi }) diff --git a/test/helpers/coverage.js b/test/helpers/coverage.js deleted file mode 100644 index 346f5b667..000000000 --- a/test/helpers/coverage.js +++ /dev/null @@ -1,20 +0,0 @@ -const skipCoverage = test => { - // Required dynamic this binding to attach onto the running test - return function skipCoverage() { - if (process.env.SOLIDITY_COVERAGE === 'true') { - this.skip() - } else { - return test() - } - } -} - -// For some reason, adding skipCoverage() to `before()`s were not working -const skipSuiteCoverage = suite => { - return process.env.SOLIDITY_COVERAGE === 'true' ? suite.skip : suite -} - -module.exports = { - skipCoverage, - skipSuiteCoverage, -}