Re-enable coverage analysis (#2291)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Igor Yalovoy
2020-09-15 20:59:42 -03:00
committed by GitHub
parent ca7ee098ca
commit c7d99531a7
5 changed files with 5631 additions and 9519 deletions

21
scripts/coverage.js Executable file
View File

@ -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);
});

View File

@ -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