diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 11:03:51 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 11:03:51 +0800 |
commit | 9b8d2ed4697d6f5542eafc289dfcf99e9b65139d (patch) | |
tree | 9cce86dce3e1e8146315c7e70ce7c1e1026525ec /packages/sol-cov/README.md | |
parent | 17148df06df36d360075fa7ef622eba804cc44f2 (diff) | |
download | dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar.gz dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar.bz2 dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar.lz dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar.xz dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.tar.zst dexon-sol-tools-9b8d2ed4697d6f5542eafc289dfcf99e9b65139d.zip |
Add sol-cov README
Diffstat (limited to 'packages/sol-cov/README.md')
-rw-r--r-- | packages/sol-cov/README.md | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/packages/sol-cov/README.md b/packages/sol-cov/README.md index 8b1378917..7201e55ab 100644 --- a/packages/sol-cov/README.md +++ b/packages/sol-cov/README.md @@ -1 +1,64 @@ +## @0xproject/sol-cov +## Installation + +```bash +yarn add -D @0xproject/sol-cov +``` + +## Usage + +``` +import { CoverageSubprovider } from '@0xproject/sol-cov' + +const provider = new ProviderEngine(); + +const artifactsPath = 'src/artifacts'; +const contractsPath = 'src/contracts'; +const networkId = 50; +const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; +const coverageSubprovider = new CoverageSubprovider( + artifactsPath, + contractsPath, + networkId, + defaultFromAddress, +); + +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. + +After all tests 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. + +## 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. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install Dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Lint + +```bash +yarn lint +``` |