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://gitter.im/sc-forks/solidity-coverage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+ For more details about what this is, how it works and potential limitations,
12
+
see [the accompanying article][16].
13
+
+`solidity-coverage` is [Solcover][17]
14
+
15
+
## Install
19
16
```
20
17
$ npm install --save-dev solidity-coverage@beta
21
18
```
22
-
### Usage notes:
23
-
+ Coverage runs tests a little more slowly.
24
-
+ Coverage distorts gas consumption. Tests that check exact gas consumption should be skipped.
25
-
+ Coverage launches its own in-process ganache server.
26
-
+ You can set [ganache options](https://github.com/trufflesuite/ganache-core#options) using the `providerOptions` key in your `.solcover.js` config.
27
19
28
-
###Truffle V5
20
+
## Truffle V5
29
21
30
-
**Add**"solidity-coverage" to your plugins array in `truffle-config.js`
22
+
**Add**this package to your plugins array in `truffle-config.js`
31
23
```javascript
32
24
module.exports= {
33
25
networks: {...},
@@ -36,24 +28,31 @@ module.exports = {
36
28
```
37
29
**Run**
38
30
```
39
-
truffle run coverage [options]
31
+
truffle run coverage [command-options]
40
32
```
41
33
34
+
## Usage notes:
35
+
+ Coverage runs tests a little more slowly.
36
+
+ Coverage launches its own in-process ganache server.
37
+
+ You can set [ganache options][1] using the `providerOptions` key in your `.solcover.js`[config][15].
38
+
+ Coverage [distorts gas consumption][13]. Tests that check exact gas consumption should be skipped.
42
39
43
-
###Command Options
44
-
| Option <imgwidth=200/> | Example <imgwidth=700/>| Description <imgwidth=1000/> |
40
+
## Command Options
41
+
| Option <imgwidth=200/> | Example <imgwidth=750/>| Description <imgwidth=1000/> |
| file |`--file="test/registry/*.js"`| Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)|
47
44
| solcoverjs |`--solcoverjs ./../.solcover.js`| Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
48
45
| network |`--network development`| Use network settings defined in the Truffle config |
49
-
| temp |`--temp build`|:warning:*Use with caution*:warning:. Disposable folder to store compilation artifacts in. Useful when your test setup scripts include hard-coded paths to a build directory. |
46
+
| temp[<sup>*</sup>][14]|`--temp build`|:warning:**Caution**:warning: Path to a *disposable*folder to store compilation artifacts in. Useful when your test setup scripts include hard-coded paths to a build directory.[More...][14]|
50
47
| version || Version info |
51
48
| help || Usage notes |
52
49
53
-
### Config Options
50
+
[<sup>*</sup> Advanced use][14]
51
+
52
+
## Config Options
54
53
55
-
Additional options can be specified in a `.solcover.js` config file located in
56
-
the root directory of your project.
54
+
Additional options can be specified in a `.solcover.js` config file located in the root directory
| skipFiles |*Array*|`['Migrations.sol']`| Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. |
| mocha |*Object*|`{ }`|[Mocha options](https://mochajs.org/api/mocha) to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.|
74
-
| onServerReady |*Function*|| Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server's availability |
75
-
|onTestsComplete|*Function*|| Hook run *after*the tests complete, *before*Istanbul reports are generated. |
76
-
|onCompileComplete|*Function*|| Hook run *after*compilation completes, *before*tests are run. Useful if you have secondary compilation steps or need to modify built artifacts. |
77
-
| onIstanbulComplete |*Function*|| Hook run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up.|
| mocha |*Object*|`{ }`|[Mocha options][3] to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.|
73
+
| onServerReady[<sup>*</sup>][14]|*Function*|| Hook run *after* server is launched, *before* the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server's availability. [More...][14]|
74
+
|onCompileComplete[<sup>*</sup>][14]|*Function*|| Hook run *after*compilation completes, *before*tests are run. Useful if you have secondary compilation steps or need to modify built artifacts. [More...][14]|
75
+
|onTestsComplete[<sup>*</sup>][14]|*Function*|| Hook run *after*the tests complete, *before*Istanbul reports are generated.|
76
+
| onIstanbulComplete[<sup>*</sup>][14]|*Function*|| Hook run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up.|
78
77
78
+
[<sup>*</sup> Advanced use][14]
79
79
80
-
81
-
### FAQ
80
+
## FAQ
82
81
83
82
Common problems & questions:
84
83
85
-
+[Running out of gas](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-out-of-gas)
86
-
+[Running out of memory (locally and in CI)](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-out-of-memory-locally-and-in-ci)
87
-
+[Running out of time (in mocha)](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-out-of-time-in-mocha)
88
-
+[Running in CI](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#continuous-integration-installing-metacoin-on-travisci-with-coveralls)
89
-
+[Why are asserts and requires highlighted as branch points?](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#why-has-my-branch-coverage-decreased-why-is-assert-being-shown-as-a-branch-point)
84
+
+[Running in CI][7]
85
+
+[Running out of gas][4]
86
+
+[Running out of time][6]
87
+
+[Running out of memory][5]
88
+
+[Why are `require` statements highlighted as branch points?][8]
0 commit comments