Add solidity-coverage

This commit is contained in:
cgewecke
2017-05-21 19:19:50 -07:00
parent 726593c0a2
commit 592548715f
4 changed files with 20 additions and 3 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
node_modules/ node_modules/
build/ build/
.DS_Store/ .DS_Store/
/coverage
coverage.json

View File

@ -6,7 +6,8 @@
"scripts": { "scripts": {
"test": "scripts/test.sh", "test": "scripts/test.sh",
"console": "truffle console", "console": "truffle console",
"install": "scripts/install.sh" "install": "scripts/install.sh",
"coverage": "scripts/coverage.sh"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -35,6 +36,7 @@
"babel-preset-stage-3": "^6.17.0", "babel-preset-stage-3": "^6.17.0",
"babel-register": "^6.23.0", "babel-register": "^6.23.0",
"ethereumjs-testrpc": "^3.0.2", "ethereumjs-testrpc": "^3.0.2",
"solidity-coverage": "^0.1.0",
"truffle": "https://github.com/ConsenSys/truffle.git#3.1.9" "truffle": "https://github.com/ConsenSys/truffle.git#3.1.9"
} }
} }

3
scripts/coverage.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
SOLIDITY_COVERAGE=true ./node_modules/.bin/solidity-coverage

View File

@ -1,10 +1,13 @@
require('babel-register'); require('babel-register');
require('babel-polyfill'); require('babel-polyfill');
var provider;
var HDWalletProvider = require('truffle-hdwallet-provider'); var HDWalletProvider = require('truffle-hdwallet-provider');
var mnemonic = '[REDACTED]'; var mnemonic = '[REDACTED]';
var provider = new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/');
if (!process.env.SOLIDITY_COVERAGE){
provider = new HDWalletProvider(mnemonic, 'https://ropsten.infura.io/')
}
module.exports = { module.exports = {
@ -17,6 +20,13 @@ module.exports = {
ropsten: { ropsten: {
provider: provider, provider: provider,
network_id: 3 // official id of the ropsten network network_id: 3 // official id of the ropsten network
},
coverage: {
host: "localhost",
network_id: "*",
port: 8555,
gas: 0xfffffffffff,
gasPrice: 0x01
} }
} }
}; };