Skip to content

Commit

Permalink
Solidity Coverage Fix (#328)
Browse files Browse the repository at this point in the history
* Updated test script

* Updated travis script

* Mac Compatibility

* Ignored mocks and oracles in test coverage
  • Loading branch information
maxsam4 authored and adamdossa committed Oct 10, 2018
1 parent c6d448e commit bfe65be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ module.exports = {
copyPackages: ['openzeppelin-solidity'],
testCommand: 'node ../node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js` --network coverage',
deepSkip: true,
skipFiles: ['external', 'flat', 'helpers']
skipFiles: ['external', 'flat', 'helpers', 'mocks', 'oracles'],
forceParse: ['mocks', 'oracles']
};
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ before_install:
- sudo apt-get -y install solc
before_script:
- truffle version
- wget -O node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
script:
- npm run test
notifications:
Expand Down
13 changes: 2 additions & 11 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,16 @@ else
fi

if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
mkdir tempPoly
mv contracts/modules/TransferManager/SingleTradeVolumeRestrictionManager.sol tempPoly/SingleTradeVolumeRestrictionManager.sol
mv contracts/modules/TransferManager/SingleTradeVolumeRestrictionManagerFactory.sol tempPoly/SingleTradeVolumeRestrictionManagerFactory.sol
mv test/x_single_trade_volume_restriction.js tempPoly/x_single_trade_volume_restriction.js
curl -o node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
node_modules/.bin/solidity-coverage

if [ "$CONTINUOUS_INTEGRATION" = true ]; then
cat coverage/lcov.info | node_modules/.bin/coveralls
fi

mv tempPoly/SingleTradeVolumeRestrictionManager.sol contracts/modules/TransferManager/SingleTradeVolumeRestrictionManager.sol
mv tempPoly/SingleTradeVolumeRestrictionManagerFactory.sol contracts/modules/TransferManager/SingleTradeVolumeRestrictionManagerFactory.sol
mv tempPoly/x_single_trade_volume_restriction.js test/x_single_trade_volume_restriction.js
rm -rf tempPoly
else
# Do not run a_poly_oracle,js tests unless it is a cron job from travis
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
node_modules/.bin/truffle test `ls test/*.js`
else
node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js`
fi
fi
fi

0 comments on commit bfe65be

Please sign in to comment.