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
| testfiles |`--testfiles "test/registry/*.ts"`| Test file(s) to run. (Globs must be enclosed by quotes and use [globby matching patterns][38])|
47
47
| sources |`--sources myFolder` or `--sources myFile.sol`| Path to *single* folder or file to target for coverage. Path is relative to Hardhat's `paths.sources` (usually `contracts/`) |
48
48
| solcoverjs |`--solcoverjs ./../.solcover.js`| Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
49
-
| network |`--network development`| Use network settings defined in the Hardhat config |
50
49
| 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]|
51
50
| 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]|
52
51
@@ -83,11 +82,9 @@ module.exports = {
83
82
| onPreCompile[<sup>*</sup>][14]|*Function*|| Hook run *after* filesystem and compiler configuration is applied, *before* the compiler is run. Can be used with the other hooks to be able to generate coverage reports on non-standard / customized directory structures, as well as contracts with absolute import paths. [More...][23]|
84
83
| 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...][23]|
85
84
| onTestsComplete[<sup>*</sup>][14]|*Function*|| Hook run *after* the tests complete, *before* Istanbul reports are generated. [More...][23]|
86
-
| 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. [More...][23]|
85
+
| onIstanbulComplete[<sup>*</sup>][14]|*Function*|| Hook run *after* the Istanbul reports are generated, *before* the coverage task completes. Useful if you need to clean resources up. [More...][23]|
87
86
| configureYulOptimizer |*Boolean*| false | (Experimental) Setting to `true` should resolve "stack too deep" compiler errors in large projects using ABIEncoderV2 |
88
87
| solcOptimizerDetails |*Object*|`undefined`|(Experimental) Must be used in combination with `configureYulOptimizer`. Allows you configure solc's [optimizer details][1001]. Useful if the default remedy for stack-too-deep errors doesn't work in your case (See FAQ below). |
89
-
| client |*Object*|`require("ganache-core")`| Ganache only: useful if you need a specific ganache version |
| compilation |`instrument`| A **pre-compilation** step: Rewrites contracts and generates an instrumentation data map. |
11
-
| client launch |`ganache`| A **substitute** step: Launches a ganache client with coverage collection enabled in its VM. As the client runs it will mark line/branch hits on the instrumentation data map. |
11
+
| client launch |`attachToHardhatVM`| A **pre-test** step: Enables coverage collection enabled in a HardhatEVM client. As the client runs it will mark line/branch hits on the instrumentation data map. |
12
12
| test |`report`| A **post-test** step: Generates a coverage report from the data collected by the VM after tests complete. |
13
-
| exit |`finish`| A **substitute** step: Shuts client down |
13
+
14
14
15
15
[3]: https://github.com/gotwarlost/istanbul
16
16
@@ -20,8 +20,8 @@ table below shows how its core methods relate to the stages of a test run:
20
20
disposable set of contracts/artifacts which coverage must use in lieu of the 'real' (uninstrumented)
21
21
contracts.
22
22
23
-
+ there are two complete [coverage tool/plugin implementations][5](for Hardhat and Truffle)
24
-
which can be used as sources if you're building something similar.
23
+
+ there is a complete [coverage tool/plugin implementation][5] for Hardhat
24
+
which can be used as a source if you're building something similar.
| skipFiles |*Array*|`[]`| Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. |
70
67
| istanbulFolder |*String*|`./coverage`| Folder location for Istanbul coverage reports. |
Enables coverage data collection on an in-process ganache server. By default, this method launches
106
-
the server, begins listening on the port specified in the [config](#constructor) (or 8555 if unspecified), and
107
-
returns a url string. When `autoLaunchServer` is false, method returns `ganache.server` so you can control
108
-
the `server.listen` invocation yourself.
101
+
Enables coverage data collection on a HardhatEVM provider. (You will need to create a hardhat provider with the correct VM settings as shown below before invoking this method.)
109
102
110
103
**Parameters**
111
104
112
-
-`client`**Object**: (*Optional*) ganache module
113
-
-`autoLaunchServer`**Boolean**: (*Optional*)
105
+
-`provider`**Object**: Hardhat provider
114
106
115
-
Returns **Promise** Address of server to connect to, or initialized, unlaunched server
0 commit comments