Skip to content

Commit 48e77b2

Browse files
committed
Misc edits for clarity
1 parent c47f160 commit 48e77b2

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
### Code coverage for Solidity testing
77
![coverage example](https://cdn-images-1.medium.com/max/800/1*uum8t-31bUaa6dTRVVhj6w.png)
88

9-
For more details about what this is, how it work and potential limitations, see
9+
For more details about what this is, how it works and potential limitations, see
1010
[the accompanying article](https://blog.colony.io/code-coverage-for-solidity-eecfa88668c2).
1111

12-
This branch is an attempt to prepare solcover for npm publication and simplify its use as a
13-
command line utility. Gas cost issues are managed under the hood and the tool cleans up after
14-
itself if (when) it crashes.
15-
1612
### Install
1713
```
1814
$ npm install --save-dev https://github.com/JoinColony/solcover.git#truffle3
@@ -24,18 +20,19 @@ $ ./node_modules/solcover/exec.js
2420
```
2521

2622
Tests run signficantly slower while coverage is being generated. A 1 to 2 minute delay
27-
between the end of Truffle compilation and the beginning of test execution is not impossible if your
23+
between the end of Truffle compilation and the beginning of test execution is possible if your
2824
test suite is large. Large solidity files can also take a while to instrument.
2925

3026
### Configuration
3127

32-
By default, solcover generates a stub `truffle.js` that accomodates its special gas needs and
33-
connects to a modified version of testrpc on port 8555. If your tests can run on the development network
28+
By default, Solcover generates a stub `truffle.js` that accomodates its special gas needs and
29+
connects to a modified version of testrpc on port 8555. If your tests will run on the development network
3430
using a standard `truffle.js` and a testrpc instance with no special options, you shouldn't have to
3531
do any configuration. If your tests depend on logic added to `truffle.js` - for example:
3632
[zeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/truffle.js)
37-
uses the file to expose a babel polyfill that its suite needs to run correctly - you can override the
38-
default behavior by specifying a coverage network in `truffle.js`.
33+
uses the file to expose a babel polyfill that its suite requires - you can override the
34+
default behavior by declaring a coverage network in `truffle.js`. Solcover will use your 'truffle.js'
35+
instead of a dynamically generated one.
3936

4037
**Example coverage network config**
4138
```javascript
@@ -61,12 +58,14 @@ You can also create a `.solcover.js` config file in the root directory of your p
6158
some additional options:
6259
+ **port**: <Number> The port you want Solcover to run testrpc on / have truffle connect to.
6360
+ **testrpcOptions**: <String> A string of options to be appended to a command line invocation
64-
of testrpc. Ex: `--account="0x89a..f',10000" --port 8777`". If you use this option specify the port
65-
in your testrpcOptions string AND as a `port` option.
61+
of testrpc.
62+
+ Example: `--account="0x89a...b1f',10000" --port 8777`".
63+
+ Note: you should specify the port in your `testrpcOptions` string AND as a `port` option.
6664
+ **testCommand**: <String> By default Solcover runs `truffle test` or `truffle test --network coverage`.
67-
`testCommand` let you run tests some other way: ex: `mocha --timeout 5000`. If you're doing this, you
68-
will probably need to make sure the web3 provider for your tests explicitly connects to the port solcover's
69-
testrpc is set to run on, e.g: `var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8555"))`
65+
This option lets you run tests some other way: ex: `mocha --timeout 5000`. You
66+
will probably also need to make sure the web3 provider for your tests explicitly connects to the port Solcover's
67+
testrpc is set to run on, e.g:
68+
+ `var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8555"))`
7069

7170
**Example .solcover.js config file**
7271
```
@@ -84,20 +83,20 @@ This is because the instrumentation process increases the gas costs for using th
8483
the extra events. If this is the case, then the coverage may be incomplete. To avoid this, using
8584
`estimateGas` to estimate your gas costs should be more resilient in most cases.
8685

87-
**Events testing**: Solcover injects events into your solidity files to log which lines your tests reach,
88-
so any tests that depend on how many events are fired or where the event sits in the logs array
86+
**Events testing**: Because Solcover injects events into your contracts to log which lines your tests reach,
87+
any tests that ask how many events are fired or where the event sits in the logs array
8988
will probably error while coverage is being generated.
9089

9190
**Using `require` in `migrations.js` files**: Truffle overloads Node's `require` function but
9291
implements a simplified search algorithm for node_modules packages
9392
([see issue #383 at Truffle](https://github.com/trufflesuite/truffle/issues/383)).
9493
Because Solcover copies an instrumented version of your project into a temporary folder, `require`
95-
statements handled by Truffle internally don't resolve correctly.
94+
statements handled by Truffle internally won't resolve correctly.
9695

9796
**Coveralls / CodeCov**: These CI services take the Istanbul reports generated by Solcover and display
98-
line coverage. Istanbul's own html report provides significantly more detailed
99-
reporting and can show whether your tests actually cover all the conditional branches
100-
in your code. It can be found inside the `coverage` folder at `index.html` after you run the tool.
97+
line coverage. Istanbul's own html report publishes significantly more detail and can show whether
98+
your tests actually reach all the conditional branches in your code. It can be found inside the
99+
`coverage` folder at `index.html` after you run the tool.
101100

102101
### Examples
103102

0 commit comments

Comments
 (0)