Merge pull request #24 from sc-forks/readme-updates

Add npm version badge, update known issues
pull/26/head
c-g-e-w-e-k-e- 8 years ago committed by GitHub
commit 924cc76fcc
  1. 42
      README.md

@ -1,5 +1,5 @@
# solidity-coverage # solidity-coverage
[![npm version](https://badge.fury.io/js/solidity-coverage.svg)](https://badge.fury.io/js/solidity-coverage)
[![CircleCI](https://circleci.com/gh/sc-forks/solidity-coverage.svg?style=svg)](https://circleci.com/gh/sc-forks/solidity-coverage) [![CircleCI](https://circleci.com/gh/sc-forks/solidity-coverage.svg?style=svg)](https://circleci.com/gh/sc-forks/solidity-coverage)
[![codecov](https://codecov.io/gh/sc-forks/solidity-coverage/branch/master/graph/badge.svg)](https://codecov.io/gh/sc-forks/solidity-coverage) [![codecov](https://codecov.io/gh/sc-forks/solidity-coverage/branch/master/graph/badge.svg)](https://codecov.io/gh/sc-forks/solidity-coverage)
[![Stories in Ready](https://badge.waffle.io/sc-forks/solidity-coverage.png?label=ready&title=Ready)](https://waffle.io/sc-forks/solidity-coverage?utm_source=badge) [![Stories in Ready](https://badge.waffle.io/sc-forks/solidity-coverage.png?label=ready&title=Ready)](https://waffle.io/sc-forks/solidity-coverage?utm_source=badge)
@ -59,24 +59,19 @@ module.exports = {
You can also create a `.solcover.js` config file in the root directory of your project and specify You can also create a `.solcover.js` config file in the root directory of your project and specify
some additional options: some additional options:
+ **port**: {Number} The port you want solidity-coverage to run testrpc on / have truffle connect to. + **port**: *{ Number }* Port to run testrpc on / have truffle connect to. (Default: 8555)
+ **testrpcOptions**: {String} A string of options to be appended to a command line invocation + **testrpcOptions**: *{ String }* options to append to a command line invocation of testrpc.
of testrpc. + ex: `--secure --unlock "0x1234..." --unlock "0xabcd..."`.
+ Example: `--account="0x89a...b1f',10000" --port 8777`". + NB: if you specify the port in your rpc options string, also declare it as a `port` option.
+ Note: you should specify the port in your `testrpcOptions` string AND as a `port` option. + **testCommand**: *{ String }* By default solidity-coverage runs `truffle test`. This option lets
+ **testCommand**: {String} By default solidity-coverage runs `truffle test` or `truffle test --network coverage`. you run an arbitrary test command instead, like: `mocha --timeout 5000`.
This option lets you run tests some other way: ex: `mocha --timeout 5000`. You + remember to set the config's port option to whatever port your tests use (probably 8545).
will probably also need to make sure the web3 provider for your tests explicitly connects to the port solidity-coverage's + make sure you don't have another instance of testrpc running on that port (web3 will error if you do).
testrpc is set to run on, e.g: + **norpc**: *{ Boolean }* When true, solidity-coverage will not launch its own testrpc instance. This
+ `var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8555"))` can be useful if you are using a different vm like the [sc-forks version of pyethereum](https://github.com/sc-forks/pyethereum).
+ **norpc**: {Boolean} When true, solidity-coverage will not launch its own testrpc instance. This + **dir**: *{ String }* : Solidity-coverage usually looks for a `contracts` folder in your root
can be useful if you are running tests using a different vm like the
[`sc-forks` version of `pyethereum`](https://github.com/sc-forks/pyethereum). (Default: false).
+ **dir**: {String} : By default, solidity-coverage looks for a `contracts` folder in your root
directory. `dir` allows you to define a relative path from the root directory to the contracts directory. `dir` allows you to define a relative path from the root directory to the contracts
folder. A `dir` of `./secretDirectory` would tell solidity-coverage to look for `./secretDirectory/contracts` folder. `dir: "./secretDirectory"` would tell solidity-coverage to look for `./secretDirectory/contracts`
**Example .solcover.js config file** **Example .solcover.js config file**
```javascript ```javascript
@ -102,14 +97,15 @@ will probably error while coverage is being generated.
**Using `require` in `migrations.js` files**: Truffle overloads Node's `require` function but **Using `require` in `migrations.js` files**: Truffle overloads Node's `require` function but
implements a simplified search algorithm for node_modules packages implements a simplified search algorithm for node_modules packages
([see issue #383 at Truffle](https://github.com/trufflesuite/truffle/issues/383)). ([see Truffle issue #383](https://github.com/trufflesuite/truffle/issues/383)).
Because solidity-coverage copies an instrumented version of your project into a temporary folder, `require` Because solidity-coverage copies an instrumented version of your project into a temporary folder, `require`
statements handled by Truffle internally won't resolve correctly. statements handled by Truffle internally won't resolve correctly.
**Coveralls / CodeCov**: These CI services take the Istanbul reports generated by solidity-coverage and display **Using HDWalletProvider in `truffle.js`**: [See Truffle issue #348](https://github.com/trufflesuite/truffle/issues/348).
line coverage. Istanbul's own html report publishes significantly more detail and can show whether HDWalletProvider tends to crash solidity-coverage and you should make sure its constructor isn't invoked while
your tests actually reach all the conditional branches in your code. It can be found inside the coverage is running. An example workaround can be found at the zeppelin-solidity project
`coverage` folder at `index.html` after you run the tool. [here](https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/truffle.js#L8-L10), where a
coverage script sets a shell environment variable and `truffle.js` checks it before instantiating the wallet.
### Examples ### Examples

Loading…
Cancel
Save