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
Copy file name to clipboardExpand all lines: README.md
+14-24Lines changed: 14 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,42 +14,33 @@
14
14
see [the accompanying article][16].
15
15
+`solidity-coverage` is [Solcover][17]
16
16
17
+
## Requirements
18
+
19
+
+ Hardhat >= 2.11.0
20
+
17
21
## Install
18
22
```
19
23
$ yarn add solidity-coverage --dev
20
24
```
21
25
22
-
**Resources**:
23
-
+[0.8.0 release notes][31]
24
-
25
-
### Hardhat
26
-
27
-
Beginning with v0.7.12, this tool supports Hardhat and runs directly on
28
-
HardhatEVM.
29
-
30
26
**Require** the plugin in `hardhat.config.js` ([Hardhat docs][26])
31
27
```javascript
32
28
require('solidity-coverage')
33
29
```
34
30
35
-
**Run**
31
+
Or, if you are using TypeScript, add this to your hardhat.config.ts:
32
+
```ts
33
+
import'solidity-coverage'
36
34
```
37
-
npx hardhat coverage [command-options]
38
-
```
39
-
40
-
(Additional Hardhat-specific info can be found [here][37])
35
+
**Resources**:
36
+
+[0.8.0 release notes][31]
41
37
42
-
### @openzeppelin/test-environment
43
38
44
-
OpenZeppelin have written their own coverage generation scripts for `test-environment` using the solidity-coverage API.
45
-
A working example can be found at [openzeppelin-contracts, here.][35]
46
39
47
-
## Usage notes:
48
-
+ Coverage runs tests a little more slowly.
49
-
+ Coverage launches its own in-process ganache server.
50
-
+ You can set [ganache options][1] using the `providerOptions` key in your `.solcover.js`[config][15].
51
-
+ Coverage [distorts gas consumption][13]. Tests that check exact gas consumption should be [skipped][24].
52
-
+:warning: Contracts are compiled **without optimization**. Please report unexpected compilation faults to [issue 417][25]
40
+
## Run
41
+
```
42
+
npx hardhat coverage [command-options]
43
+
```
53
44
54
45
## Command Options
55
46
| Option <imgwidth=200/> | Example <imgwidth=750/>| Description <imgwidth=1000/> |
@@ -58,8 +49,7 @@ A working example can be found at [openzeppelin-contracts, here.][35]
58
49
| solcoverjs |`--solcoverjs ./../.solcover.js`| Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
59
50
| network |`--network development`| Use network settings defined in the Hardhat config |
60
51
| 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]|
61
-
| matrix | `--matrix` | Generate a JSON object that maps which mocha tests hit which lines of code. (Useful
62
-
as an input for some fuzzing, mutation testing and fault-localization algorithms.) [More...][39]|
52
+
| matrix |`--matrix`| Generate a JSON object that maps which mocha tests hit which lines of code. (Useful as an input for some fuzzing, mutation testing and fault-localization algorithms.) [More...][39]|
0 commit comments