You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://waffle.io/sc-forks/solidity-coverage?utm_source=badge)
@@ -18,46 +17,35 @@ find discrepancies between the coverage report and your suite's behavior, please
18
17
19
18
### Install
20
19
```
21
-
$ npm install --save-dev solidity-coverage
20
+
$ npm install --save-dev solidity-coverage@beta
22
21
```
23
22
24
23
### Run
25
24
26
-
#### Option 1
27
-
28
-
```
29
-
$ ./node_modules/.bin/solidity-coverage
30
-
```
31
-
32
-
#### Option 2
33
-
34
25
```
35
-
$ $(npm bin)/solidity-coverage
26
+
$ npx solidity-coverage
36
27
```
37
28
38
-
Tests run significantly slower while coverage is being generated. Your contracts are double-compiled
39
-
and a 1 to 2 minute delay between the end of the second compilation and the beginning of test execution
40
-
is possible if your test suite is large. Large Solidity files can also take a while to instrument.
41
-
42
-
**Important: breaking change for versions >= `0.5.0`**
43
-
+`solidity-coverage` requires compilation with `solc` >= `0.4.21`. We're prefixing our own
44
-
instrumentation events with the `emit` keyword to reduce warnings volume when running the tool.
45
-
+ Ternary conditionals (ex: `(x) ? y : z;`) no longer receive branch coverage. There's more info about
46
-
why this isn't currently possible at [solidity 3887](https://github.com/ethereum/solidity/issues/3887).
29
+
**NB:** for most projects you'll also need to configure a 'coverage' network in
30
+
truffle-config.js. See the Network Configuration guide below.
47
31
48
-
**Important: breaking change for versions >= `0.4.3`**
49
-
+ solidity-coverage now expects a globally installed truffle in your environment / on CI. If you
32
+
### Usage notes:
33
+
+ Requires Solidity pragmas >= `0.5.0`.
34
+
+ Tests run more slowly while coverage is being generated.
35
+
+ Your contracts will be double-compiled and a delay between compilation and
36
+
the beginning of test execution is possible if your contracts are large.
37
+
+ solidity-coverage expects a globally installed truffle in your environment / on CI. If you
50
38
prefer to control which Truffle version your tests are run with, please see the FAQ for
51
39
[running truffle as a local dependency](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-truffle-as-a-local-dependency).
52
-
53
-
+ Solidity fixtures / mocks / tests stored in the `tests/` directory are no longer supported. If your suite uses native Solidity testing or accesses contracts via mocks stored in `tests/` (a la Zeppelin), coverage will trigger test errors because it's unable to rewrite your contract ABIs appropriately. Mocks should be relocated to the root folder's `contracts` directory. More on why this is necessary at issue [146](https://github.com/sc-forks/solidity-coverage/issues/146)
40
+
+ Solidity fixtures / mocks stored in the `tests/` directory are no longer supported. If your suite uses native Solidity testing or accesses contracts via mocks stored in `tests/` (a la Zeppelin), coverage will trigger test errors because it's unable to rewrite your contract ABIs appropriately. Mocks should be relocated to the root folder's `contracts` directory. More on why this is necessary at issue [146](https://github.com/sc-forks/solidity-coverage/issues/146)
54
41
55
42
### Network Configuration
56
43
57
-
By default, solidity-coverage generates a stub `truffle.js` that accommodates its special gas needs and
58
-
connects to a coverage-enabled fork of the ganache-cli client called **testrpc-sc** on port 8555. This special client ships with `solidity-coverage` - there's nothing extra to download. If your tests will run on truffle's development network
59
-
using a standard `truffle.js` and ganache-cli instance, you shouldn't have to do any configuration or launch the coverage client separately. If your tests depend on logic or special options added to `truffle.js` you should declare a coverage
60
-
network there following the example below.
44
+
By default, solidity-coverage connects to a coverage-enabled fork of the ganache-cli client
45
+
called **testrpc-sc** on port 8555. (It ships with `solidity-coverage` -
46
+
there's nothing extra to download.)
47
+
48
+
In `truffle-config.js`, add a coverage network following the example below.
0 commit comments