Re-enable coverage analysis (#2291)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
pull/2349/head
Igor Yalovoy 4 years ago committed by GitHub
parent ca7ee098ca
commit c7d99531a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21502
      package-lock.json
  2. 8
      package.json
  3. 21
      scripts/coverage.js
  4. 25
      scripts/coverage.sh
  5. 8
      test/utils/Address.test.js

21502
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@
], ],
"scripts": { "scripts": {
"compile": "scripts/compile.sh", "compile": "scripts/compile.sh",
"coverage": "scripts/coverage.sh", "coverage": "scripts/coverage.js",
"docs": "oz-docs", "docs": "oz-docs",
"docs:watch": "npm run docs watch contracts 'docs/*.hbs'", "docs:watch": "npm run docs watch contracts 'docs/*.hbs'",
"prepare-docs": "scripts/prepare-docs.sh", "prepare-docs": "scripts/prepare-docs.sh",
@ -50,7 +50,7 @@
"@openzeppelin/docs-utils": "^0.1.0", "@openzeppelin/docs-utils": "^0.1.0",
"@openzeppelin/gsn-helpers": "^0.2.3", "@openzeppelin/gsn-helpers": "^0.2.3",
"@openzeppelin/gsn-provider": "^0.1.10", "@openzeppelin/gsn-provider": "^0.1.10",
"@openzeppelin/test-environment": "^0.1.4", "@openzeppelin/test-environment": "^0.1.5",
"@openzeppelin/test-helpers": "^0.5.6", "@openzeppelin/test-helpers": "^0.5.6",
"chai": "^4.2.0", "chai": "^4.2.0",
"eslint": "^6.5.1", "eslint": "^6.5.1",
@ -61,14 +61,14 @@
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1", "eslint-plugin-standard": "^4.0.1",
"ethereumjs-util": "^7.0.1", "ethereumjs-util": "^7.0.1",
"ganache-core-coverage": "https://github.com/OpenZeppelin/ganache-core-coverage/releases/download/2.5.3-coverage/ganache-core-coverage-2.5.3.tgz", "ganache-cli": "^6.9.1",
"lodash.startcase": "^4.4.0", "lodash.startcase": "^4.4.0",
"lodash.zip": "^4.2.0", "lodash.zip": "^4.2.0",
"micromatch": "^4.0.2", "micromatch": "^4.0.2",
"mocha": "^8.0.1", "mocha": "^8.0.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"solhint": "^3.2.0", "solhint": "^3.2.0",
"solidity-coverage": "github:rotcivegaf/solidity-coverage#5875f5b7bc74d447f3312c9c0e9fc7814b482477", "solidity-coverage": "^0.7.8",
"solidity-docgen": "^0.5.3" "solidity-docgen": "^0.5.3"
}, },
"dependencies": {} "dependencies": {}

@ -0,0 +1,21 @@
#!/usr/bin/env node
const { execSync } = require('child_process');
const { runCoverage } = require('@openzeppelin/test-environment');
async function main () {
await runCoverage(
['mocks'],
'npm run compile',
'./node_modules/.bin/mocha --exit --timeout 10000 --recursive'.split(' '),
);
if (process.env.CI) {
execSync('curl -s https://codecov.io/bash | bash -s -- -C "$CIRCLE_SHA1"', { stdio: 'inherit' });
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});

@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -o errexit -o pipefail
# Executes cleanup function at script exit.
trap cleanup EXIT
cleanup() {
# Delete the symlink created to the allFiredEvents file solidity-coverage creates
rm -f allFiredEvents
}
log() {
echo "$*" >&2
}
# The allFiredEvents file is created inside coverageEnv, but solidity-coverage
# expects it to be at the top level. We create a symlink to fix this
ln -s coverageEnv/allFiredEvents allFiredEvents
OZ_TEST_ENV_COVERAGE=true npx solidity-coverage || log "Test run failed"
if [ "$CI" = true ]; then
curl -s https://codecov.io/bash | bash -s -- -C "$CIRCLE_SHA1"
fi

@ -1,4 +1,4 @@
const { accounts, contract, web3 } = require('@openzeppelin/test-environment'); const { accounts, contract, web3, config } = require('@openzeppelin/test-environment');
const { balance, ether, expectRevert, send, expectEvent } = require('@openzeppelin/test-helpers'); const { balance, ether, expectRevert, send, expectEvent } = require('@openzeppelin/test-helpers');
const { expect } = require('chai'); const { expect } = require('chai');
@ -7,6 +7,8 @@ const AddressImpl = contract.fromArtifact('AddressImpl');
const EtherReceiver = contract.fromArtifact('EtherReceiverMock'); const EtherReceiver = contract.fromArtifact('EtherReceiverMock');
const CallReceiverMock = contract.fromArtifact('CallReceiverMock'); const CallReceiverMock = contract.fromArtifact('CallReceiverMock');
const coverage = config.coverage;
describe('Address', function () { describe('Address', function () {
const [ recipient, other ] = accounts; const [ recipient, other ] = accounts;
@ -137,7 +139,11 @@ describe('Address', function () {
); );
}); });
// Skipped in a coverage mode due to coverage mode setting a block gas limit to 0xffffffffff
// which cause a mockFunctionOutOfGas function to crash Ganache and the
// subsequent tests before running out of gas.
it('reverts when the called function runs out of gas', async function () { it('reverts when the called function runs out of gas', async function () {
if (coverage) { return this.skip(); }
const abiEncodedCall = web3.eth.abi.encodeFunctionCall({ const abiEncodedCall = web3.eth.abi.encodeFunctionCall({
name: 'mockFunctionOutOfGas', name: 'mockFunctionOutOfGas',
type: 'function', type: 'function',

Loading…
Cancel
Save