From 5b90a3e9d292a38a2a63e8c3ad99d3064ce7db4f Mon Sep 17 00:00:00 2001 From: Kanstantsin Andryanau Date: Mon, 9 Sep 2019 00:15:27 -0700 Subject: [PATCH] Make istanbul reporter configurable --- README.md | 5 +++-- lib/app.js | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 48a7e04..704faa9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ a local dependency, please see [this section](https://github.com/sc-forks/solidi ### Network Configuration By default, this tool connects to a coverage-enabled fork of ganache-cli -called **testrpc-sc** on port 8555. +called **testrpc-sc** on port 8555. + it's a dependency - there's nothing extra to download. + the solidity-coverage command launches it automatically in the background. (See [this section of the FAQ](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-testrpc-sc-on-its-own) if you need to launch it separately yourself) @@ -95,7 +95,8 @@ module.exports = { | skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. `Migrations.sol` is skipped by default, and does not need to be added to this configuration option if it is used. | | deepSkip | boolean | false | Use this if instrumentation hangs on large, skipped files (like Oraclize). It's faster. | | dir | *String* | `.` | Solidity-coverage copies all the assets in your root directory (except `node_modules`) to a special folder where it instruments the contracts and executes the tests. `dir` allows you to define a relative path from the root directory to those assets. Useful if your contracts & tests are within their own folder as part of a larger project.| -| buildDirPath | *String* | `/build/contracts` | Build directory path for compiled smart contracts +| buildDirPath | *String* | `/build/contracts` | Build directory path for compiled smart contracts | +| istanbulReporter | *Array* | ['html', 'lcov', 'text'] | Coverage reporters for Istanbul. Optional reporter replaces the default reporters. | ### FAQ diff --git a/lib/app.js b/lib/app.js index bcfbd02..af29aff 100644 --- a/lib/app.js +++ b/lib/app.js @@ -42,6 +42,8 @@ class App { this.gasLimit = 0xfffffffffff; this.gasLimitString = "0xfffffffffff"; this.gasPrice = 0x01; + + this.istanbulReporter = config.istanbulReporter || ['html', 'lcov', 'text']; } // -------------------------------------- Methods ----------------------------------------------- @@ -122,9 +124,8 @@ class App { this.saveCoverage(relativeMapping); collector.add(relativeMapping); - reporter.add('html'); - reporter.add('lcov'); - reporter.add('text'); + + this.istanbulReporter.forEach(report => reporter.add(report)); reporter.write(collector, true, () => { this.log('Istanbul coverage reports generated');