diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-12 19:32:07 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-12 19:32:07 +0800 |
commit | 44f7f79bd957dc54cbc562797d6785ad5b295d4f (patch) | |
tree | f0415dc7d2399b99c14f50db7f405858feb0d048 /packages/sol-cov/README.md | |
parent | 2a9913b8fbcc4911593eab0ecdec3b62328e0b31 (diff) | |
download | dexon-sol-tools-44f7f79bd957dc54cbc562797d6785ad5b295d4f.tar.gz dexon-sol-tools-44f7f79bd957dc54cbc562797d6785ad5b295d4f.tar.zst dexon-sol-tools-44f7f79bd957dc54cbc562797d6785ad5b295d4f.zip |
Improve the sol-cov readme
Diffstat (limited to 'packages/sol-cov/README.md')
-rw-r--r-- | packages/sol-cov/README.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/sol-cov/README.md b/packages/sol-cov/README.md index 7201e55ab..fec087394 100644 --- a/packages/sol-cov/README.md +++ b/packages/sol-cov/README.md @@ -1,5 +1,7 @@ ## @0xproject/sol-cov +A Solidity code coverage tool. + ## Installation ```bash @@ -8,6 +10,8 @@ yarn add -D @0xproject/sol-cov ## Usage +Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0xproject.com/wiki#Web3-Provider-Explained) wiki article. + ``` import { CoverageSubprovider } from '@0xproject/sol-cov' @@ -27,19 +31,19 @@ const coverageSubprovider = new CoverageSubprovider( provider.addProvider(coverageSubprovider); ``` -Sol-cov is a subprovider that you add to your [provider engine](https://github.com/MetaMask/provider-engine). If you're unfamilliar with ProviderEngine - read `More complex providers` section [here](https://0xproject.com/wiki#Web3-Provider-Explained). It eavesdrops `eth_sendTransaction` and `eth_call` and collects traces after each one of them using `debug_traceTransaction`. `eth_call` doesn't generate the trace - so we first do a snapshot, then submit it as a transaction, then get a trace and then revert a snapshot. +The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot. -After all tests you'll need to call: +After all your tests are run, you'll need to call: ``` await coverageSubprovider.writeCoverageAsync() ``` -This will create `coverage.json` file in your `coverage` directory. This file has an [istanbul format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md) - so you can use any of the instanbul reporters. +This will create a `coverage.json` file in the `coverage` directory. This file has an [Istanbul format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md) - so you can use any of the existing Instanbul reporters. ## Contributing -We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository. +We strongly encourage the community to help us make improvements. To report bugs within this package, please create an issue in this repository. Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. |