Re-enable solidity coverage

- Upgrade version
- Re-enable in travis.yml
- Move mocks to contracts folder for instrumentation
pull/617/head
Santiago Palladino 7 years ago
parent ddcae6254e
commit 1455a5a942
  1. 1
      .gitignore
  2. 6
      .solcover.js
  3. 7
      .travis.yml
  4. 2
      contracts/mocks/BasicTokenMock.sol
  5. 2
      contracts/mocks/BurnableTokenMock.sol
  6. 2
      contracts/mocks/CappedCrowdsaleImpl.sol
  7. 0
      contracts/mocks/DayLimitMock.sol
  8. 4
      contracts/mocks/DetailedERC20Mock.sol
  9. 2
      contracts/mocks/ERC23TokenMock.sol
  10. 2
      contracts/mocks/FinalizableCrowdsaleImpl.sol
  11. 0
      contracts/mocks/ForceEther.sol
  12. 0
      contracts/mocks/HasNoEtherTest.sol
  13. 0
      contracts/mocks/InsecureTargetBounty.sol
  14. 2
      contracts/mocks/LimitBalanceMock.sol
  15. 2
      contracts/mocks/PausableMock.sol
  16. 2
      contracts/mocks/PausableTokenMock.sol
  17. 2
      contracts/mocks/PullPaymentMock.sol
  18. 2
      contracts/mocks/RBACMock.sol
  19. 0
      contracts/mocks/ReentrancyAttack.sol
  20. 2
      contracts/mocks/ReentrancyMock.sol
  21. 2
      contracts/mocks/RefundableCrowdsaleImpl.sol
  22. 4
      contracts/mocks/SafeERC20Helper.sol
  23. 2
      contracts/mocks/SafeMathMock.sol
  24. 0
      contracts/mocks/SecureTargetBounty.sol
  25. 2
      contracts/mocks/StandardTokenMock.sol
  26. 1315
      package-lock.json
  27. 2
      package.json
  28. 2
      test/BasicToken.test.js
  29. 2
      test/BurnableToken.test.js
  30. 2
      test/CanReclaimToken.test.js
  31. 2
      test/CappedCrowdsale.test.js
  32. 2
      test/DayLimit.test.js
  33. 2
      test/DetailedERC20.test.js
  34. 2
      test/FinalizableCrowdsale.test.js
  35. 2
      test/HasNoTokens.test.js
  36. 2
      test/PausableToken.test.js
  37. 2
      test/PullPayment.test.js
  38. 2
      test/RBAC.test.js
  39. 2
      test/RefundableCrowdsale.test.js
  40. 2
      test/SafeERC20.test.js
  41. 2
      test/SafeMath.test.js
  42. 2
      test/StandardToken.test.js
  43. 2
      test/TokenDestructible.test.js

1
.gitignore vendored

@ -15,6 +15,7 @@ scTopics
# Coverage directory used by tools like istanbul # Coverage directory used by tools like istanbul
coverage coverage
coverage.json coverage.json
coverageEnv
# node-waf configuration # node-waf configuration
.lock-wscript .lock-wscript

@ -1,5 +1,9 @@
module.exports = { module.exports = {
norpc: true, norpc: true,
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage', testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
skipFiles: ['lifecycle/Migrations.sol'] compileCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage',
skipFiles: [
'lifecycle/Migrations.sol',
'mocks'
]
} }

@ -7,6 +7,13 @@ node_js:
cache: cache:
directories: directories:
- node_modules - node_modules
env:
-
- SOLIDITY_COVERAGE=true
matrix:
fast_finish: true
allow_failures:
- env: SOLIDITY_COVERAGE=true
before_script: before_script:
- truffle version - truffle version
script: script:

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/BasicToken.sol'; import '../token/BasicToken.sol';
// mock class using BasicToken // mock class using BasicToken

@ -1,6 +1,6 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/BurnableToken.sol'; import '../token/BurnableToken.sol';
contract BurnableTokenMock is BurnableToken { contract BurnableTokenMock is BurnableToken {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/crowdsale/CappedCrowdsale.sol'; import '../crowdsale/CappedCrowdsale.sol';
contract CappedCrowdsaleImpl is CappedCrowdsale { contract CappedCrowdsaleImpl is CappedCrowdsale {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/StandardToken.sol'; import '../token/StandardToken.sol';
import '../../contracts/token/DetailedERC20.sol'; import '../token/DetailedERC20.sol';
contract DetailedERC20Mock is StandardToken, DetailedERC20 { contract DetailedERC20Mock is StandardToken, DetailedERC20 {
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {} function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {}

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/BasicToken.sol'; import '../token/BasicToken.sol';
contract ERC23ContractInterface { contract ERC23ContractInterface {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/crowdsale/FinalizableCrowdsale.sol'; import '../crowdsale/FinalizableCrowdsale.sol';
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale { contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/LimitBalance.sol'; import '../LimitBalance.sol';
// mock class using LimitBalance // mock class using LimitBalance

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/lifecycle/Pausable.sol'; import '../lifecycle/Pausable.sol';
// mock class using Pausable // mock class using Pausable

@ -1,6 +1,6 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/PausableToken.sol'; import '../token/PausableToken.sol';
// mock class using PausableToken // mock class using PausableToken
contract PausableTokenMock is PausableToken { contract PausableTokenMock is PausableToken {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/payment/PullPayment.sol'; import '../payment/PullPayment.sol';
// mock class using PullPayment // mock class using PullPayment

@ -1,6 +1,6 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.8;
import '../../contracts/ownership/rbac/RBAC.sol'; import '../ownership/rbac/RBAC.sol';
contract RBACMock is RBAC { contract RBACMock is RBAC {

@ -1,6 +1,6 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/ReentrancyGuard.sol'; import '../ReentrancyGuard.sol';
import './ReentrancyAttack.sol'; import './ReentrancyAttack.sol';
contract ReentrancyMock is ReentrancyGuard { contract ReentrancyMock is ReentrancyGuard {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/crowdsale/RefundableCrowdsale.sol'; import '../crowdsale/RefundableCrowdsale.sol';
contract RefundableCrowdsaleImpl is RefundableCrowdsale { contract RefundableCrowdsaleImpl is RefundableCrowdsale {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/ERC20.sol'; import '../token/ERC20.sol';
import '../../contracts/token/SafeERC20.sol'; import '../token/SafeERC20.sol';
contract ERC20FailingMock is ERC20 { contract ERC20FailingMock is ERC20 {
function transfer(address, uint256) public returns (bool) { function transfer(address, uint256) public returns (bool) {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/math/SafeMath.sol'; import '../math/SafeMath.sol';
contract SafeMathMock { contract SafeMathMock {

@ -1,7 +1,7 @@
pragma solidity ^0.4.18; pragma solidity ^0.4.18;
import '../../contracts/token/StandardToken.sol'; import '../token/StandardToken.sol';
// mock class using StandardToken // mock class using StandardToken

1315
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@
"ethereumjs-testrpc": "^6.0.1", "ethereumjs-testrpc": "^6.0.1",
"ethereumjs-util": "^5.1.2", "ethereumjs-util": "^5.1.2",
"mocha-lcov-reporter": "^1.3.0", "mocha-lcov-reporter": "^1.3.0",
"solidity-coverage": "^0.2.2", "solidity-coverage": "^0.4.3",
"truffle": "^4.0.0", "truffle": "^4.0.0",
"truffle-hdwallet-provider": "0.0.3" "truffle-hdwallet-provider": "0.0.3"
}, },

@ -1,6 +1,6 @@
const assertRevert = require('./helpers/assertRevert'); const assertRevert = require('./helpers/assertRevert');
var BasicTokenMock = artifacts.require('./mocks/BasicTokenMock.sol'); var BasicTokenMock = artifacts.require('mocks/BasicTokenMock.sol');
contract('BasicToken', function (accounts) { contract('BasicToken', function (accounts) {
it('should return the correct totalSupply after construction', async function () { it('should return the correct totalSupply after construction', async function () {

@ -1,6 +1,6 @@
const EVMRevert = require('./helpers/EVMRevert.js'); const EVMRevert = require('./helpers/EVMRevert.js');
const BurnableTokenMock = artifacts.require('./mocks/BurnableTokenMock.sol'); const BurnableTokenMock = artifacts.require('mocks/BurnableTokenMock.sol');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;
require('chai') require('chai')

@ -2,7 +2,7 @@
import expectThrow from './helpers/expectThrow'; import expectThrow from './helpers/expectThrow';
const CanReclaimToken = artifacts.require('../contracts/ownership/CanReclaimToken.sol'); const CanReclaimToken = artifacts.require('../contracts/ownership/CanReclaimToken.sol');
const BasicTokenMock = artifacts.require('./mocks/BasicTokenMock.sol'); const BasicTokenMock = artifacts.require('mocks/BasicTokenMock.sol');
contract('CanReclaimToken', function (accounts) { contract('CanReclaimToken', function (accounts) {
let token = null; let token = null;

@ -11,7 +11,7 @@ require('chai')
.use(require('chai-bignumber')(BigNumber)) .use(require('chai-bignumber')(BigNumber))
.should(); .should();
const CappedCrowdsale = artifacts.require('./mocks/CappedCrowdsaleImpl.sol'); const CappedCrowdsale = artifacts.require('mocks/CappedCrowdsaleImpl.sol');
const MintableToken = artifacts.require('MintableToken'); const MintableToken = artifacts.require('MintableToken');
contract('CappedCrowdsale', function ([_, wallet]) { contract('CappedCrowdsale', function ([_, wallet]) {

@ -4,7 +4,7 @@ import { increaseTimeTo, duration } from './helpers/increaseTime';
const assertRevert = require('./helpers/assertRevert'); const assertRevert = require('./helpers/assertRevert');
const DayLimitMock = artifacts.require('./mocks/DayLimitMock.sol'); const DayLimitMock = artifacts.require('mocks/DayLimitMock.sol');
contract('DayLimit', function (accounts) { contract('DayLimit', function (accounts) {
let dayLimit; let dayLimit;

@ -5,7 +5,7 @@ require('chai')
.use(require('chai-bignumber')(BigNumber)) .use(require('chai-bignumber')(BigNumber))
.should(); .should();
const DetailedERC20Mock = artifacts.require('./mocks/DetailedERC20Mock.sol'); const DetailedERC20Mock = artifacts.require('mocks/DetailedERC20Mock.sol');
contract('DetailedERC20', accounts => { contract('DetailedERC20', accounts => {
let detailedERC20 = null; let detailedERC20 = null;

@ -10,7 +10,7 @@ const should = require('chai')
.use(require('chai-bignumber')(BigNumber)) .use(require('chai-bignumber')(BigNumber))
.should(); .should();
const FinalizableCrowdsale = artifacts.require('./mocks/FinalizableCrowdsaleImpl.sol'); const FinalizableCrowdsale = artifacts.require('mocks/FinalizableCrowdsaleImpl.sol');
const MintableToken = artifacts.require('MintableToken'); const MintableToken = artifacts.require('MintableToken');
contract('FinalizableCrowdsale', function ([_, owner, wallet, thirdparty]) { contract('FinalizableCrowdsale', function ([_, owner, wallet, thirdparty]) {

@ -2,7 +2,7 @@
import expectThrow from './helpers/expectThrow'; import expectThrow from './helpers/expectThrow';
const HasNoTokens = artifacts.require('../contracts/lifecycle/HasNoTokens.sol'); const HasNoTokens = artifacts.require('../contracts/lifecycle/HasNoTokens.sol');
const ERC23TokenMock = artifacts.require('./mocks/ERC23TokenMock.sol'); const ERC23TokenMock = artifacts.require('mocks/ERC23TokenMock.sol');
contract('HasNoTokens', function (accounts) { contract('HasNoTokens', function (accounts) {
let hasNoTokens = null; let hasNoTokens = null;

@ -1,7 +1,7 @@
'user strict'; 'user strict';
const assertRevert = require('./helpers/assertRevert'); const assertRevert = require('./helpers/assertRevert');
var PausableTokenMock = artifacts.require('./mocks/PausableTokenMock.sol'); var PausableTokenMock = artifacts.require('mocks/PausableTokenMock.sol');
contract('PausableToken', function (accounts) { contract('PausableToken', function (accounts) {
let token; let token;

@ -1,4 +1,4 @@
var PullPaymentMock = artifacts.require('./mocks/PullPaymentMock.sol'); var PullPaymentMock = artifacts.require('mocks/PullPaymentMock.sol');
contract('PullPayment', function (accounts) { contract('PullPayment', function (accounts) {
let ppce; let ppce;

@ -1,7 +1,7 @@
import expectThrow from './helpers/expectThrow'; import expectThrow from './helpers/expectThrow';
import expectEvent from './helpers/expectEvent'; import expectEvent from './helpers/expectEvent';
const RBACMock = artifacts.require('./mocks/RBACMock.sol'); const RBACMock = artifacts.require('mocks/RBACMock.sol');
require('chai') require('chai')
.use(require('chai-as-promised')) .use(require('chai-as-promised'))

@ -11,7 +11,7 @@ require('chai')
.use(require('chai-bignumber')(BigNumber)) .use(require('chai-bignumber')(BigNumber))
.should(); .should();
const RefundableCrowdsale = artifacts.require('./mocks/RefundableCrowdsaleImpl.sol'); const RefundableCrowdsale = artifacts.require('mocks/RefundableCrowdsaleImpl.sol');
contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) { contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
const rate = new BigNumber(1000); const rate = new BigNumber(1000);

@ -4,7 +4,7 @@ require('chai')
.use(require('chai-as-promised')) .use(require('chai-as-promised'))
.should(); .should();
const SafeERC20Helper = artifacts.require('./mocks/SafeERC20Helper.sol'); const SafeERC20Helper = artifacts.require('mocks/SafeERC20Helper.sol');
contract('SafeERC20', function () { contract('SafeERC20', function () {
beforeEach(async function () { beforeEach(async function () {

@ -1,6 +1,6 @@
const assertRevert = require('./helpers/assertRevert'); const assertRevert = require('./helpers/assertRevert');
const assertJump = require('./helpers/assertJump'); const assertJump = require('./helpers/assertJump');
var SafeMathMock = artifacts.require('./mocks/SafeMathMock.sol'); var SafeMathMock = artifacts.require('mocks/SafeMathMock.sol');
contract('SafeMath', function (accounts) { contract('SafeMath', function (accounts) {
let safeMath; let safeMath;

@ -1,7 +1,7 @@
const assertRevert = require('./helpers/assertRevert'); const assertRevert = require('./helpers/assertRevert');
var StandardTokenMock = artifacts.require('./mocks/StandardTokenMock.sol'); var StandardTokenMock = artifacts.require('mocks/StandardTokenMock.sol');
contract('StandardToken', function (accounts) { contract('StandardToken', function (accounts) {
let token; let token;

@ -1,6 +1,6 @@
var TokenDestructible = artifacts.require('../contracts/lifecycle/TokenDestructible.sol'); var TokenDestructible = artifacts.require('../contracts/lifecycle/TokenDestructible.sol');
var StandardTokenMock = artifacts.require('./mocks/StandardTokenMock.sol'); var StandardTokenMock = artifacts.require('mocks/StandardTokenMock.sol');
require('./helpers/transactionMined.js'); require('./helpers/transactionMined.js');
contract('TokenDestructible', function (accounts) { contract('TokenDestructible', function (accounts) {

Loading…
Cancel
Save