Browse Source

Add solidity-coverage

cgewecke 8 years ago
parent
commit
592548715f
4 changed files with 20 additions and 3 deletions
  1. 2 0
      .gitignore
  2. 3 1
      package.json
  3. 3 0
      scripts/coverage.sh
  4. 12 2
      truffle.js

+ 2 - 0
.gitignore

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

+ 3 - 1
package.json

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

+ 3 - 0
scripts/coverage.sh

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

+ 12 - 2
truffle.js

@@ -1,10 +1,13 @@
 require('babel-register');
 require('babel-polyfill');
 
+var provider;
 var HDWalletProvider = require('truffle-hdwallet-provider');
-
 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 = {
@@ -17,6 +20,13 @@ module.exports = {
     ropsten: {
       provider: provider,
       network_id: 3 // official id of the ropsten network
+    },
+    coverage: {
+      host: "localhost",
+      network_id: "*", 
+      port: 8555,         
+      gas: 0xfffffffffff, 
+      gasPrice: 0x01      
     }
   }
 };