monocart-coverage-reports
Advanced tools
Comparing version 2.6.1 to 2.6.2
@@ -230,2 +230,3 @@ #!/usr/bin/env node | ||
.argument('<command>', 'command to execute') | ||
.allowUnknownOption() | ||
.option('-c, --config <path>', 'custom config path') | ||
@@ -248,3 +249,4 @@ .option('-o, --outputDir <dir>', 'output dir for reports') | ||
.action((command, cliOptions) => { | ||
.action((_command, cliOptions) => { | ||
const command = program.args.join(' '); | ||
executeCommand(command, cliOptions); | ||
@@ -251,0 +253,0 @@ }); |
@@ -24,17 +24,18 @@ const fs = require('fs'); | ||
let report; | ||
let istanbulCoverageResults; | ||
// v8 to istanbul reports | ||
if (options.reportGroup.istanbul) { | ||
istanbulCoverageResults = await saveIstanbulReports(coverageData, fileSources, options); | ||
} | ||
const { v8, istanbul } = options.reportGroup; | ||
// v8 reports and v8 coverage results | ||
// could be no v8 or v8-json, but requires v8 coverage results | ||
const v8CoverageResults = await saveV8Report(v8list, options); | ||
// generate istanbul reports first | ||
if (istanbul) { | ||
report = await saveIstanbulReports(coverageData, fileSources, options); | ||
// fix reportPath | ||
if (!v8CoverageResults.reportPath && istanbulCoverageResults) { | ||
v8CoverageResults.reportPath = istanbulCoverageResults.reportPath; | ||
} | ||
// generate v8 report | ||
if (v8) { | ||
report = await saveV8Report(v8list, options); | ||
} | ||
return report; | ||
return v8CoverageResults; | ||
}; | ||
@@ -41,0 +42,0 @@ |
@@ -359,3 +359,3 @@ const path = require('path'); | ||
// v8 reports | ||
// v8 only reports | ||
const buildInV8Reports = { | ||
@@ -368,10 +368,13 @@ 'v8': handleV8HtmlReport, | ||
const v8Group = options.reportGroup.v8; | ||
const v8Reports = Object.keys(v8Group); | ||
for (const reportName of v8Reports) { | ||
const reportOptions = v8Group[reportName]; | ||
const buildInHandler = buildInV8Reports[reportName]; | ||
if (buildInHandler) { | ||
outputs[reportName] = await buildInHandler(reportData, reportOptions, options); | ||
} else { | ||
outputs[reportName] = await Util.runCustomReporter(reportName, reportData, reportOptions, options); | ||
// could be no v8 only reports, but have `both` data reports | ||
if (v8Group) { | ||
const v8Reports = Object.keys(v8Group); | ||
for (const reportName of v8Reports) { | ||
const reportOptions = v8Group[reportName]; | ||
const buildInHandler = buildInV8Reports[reportName]; | ||
if (buildInHandler) { | ||
outputs[reportName] = await buildInHandler(reportData, reportOptions, options); | ||
} else { | ||
outputs[reportName] = await Util.runCustomReporter(reportName, reportData, reportOptions, options); | ||
} | ||
} | ||
@@ -378,0 +381,0 @@ } |
{ | ||
"name": "monocart-coverage-reports", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "Monocart coverage reports", | ||
@@ -37,7 +37,7 @@ "main": "./lib/index.js", | ||
"test-css": "node ./test/test-css.js", | ||
"test-cli": "npx mcr \"node ./test/test-node-env.js\" -o docs/cli -c test/cli-options.js", | ||
"test-cli": "npx mcr node ./test/test-node-env.js -o docs/cli -c test/cli-options.js", | ||
"test-merge": "node ./test/test-merge.js", | ||
"test-merge-istanbul": "node ./test/test-merge-istanbul.js", | ||
"test-all": "npm run test-browser && npm run test-node && npm run test-cli && npm run test-merge && npm run build-docs", | ||
"test": "npx mcr \"npm run test-all\" -c test/mcr-options.js", | ||
"test": "npx mcr npm run test-all -c test/mcr-options.js", | ||
"test:snap": "cross-env TEST_SNAPSHOT=true npm run test", | ||
@@ -44,0 +44,0 @@ "dev": "sf d v8", |
@@ -261,11 +261,11 @@ # Monocart Coverage Reports | ||
> The CLI will run the program as a [child process](https://nodejs.org/docs/latest/api/child_process.html) with `NODE_V8_COVERAGE=dir` until it exits gracefully, and generate the coverage report with the coverage data from the `dir`. | ||
- Global mode | ||
- Installing globally | ||
```sh | ||
npm i monocart-coverage-reports -g | ||
mcr "node ./test/test-node-env.js" -r v8,console-summary --lcov | ||
mcr node ./test/test-node-env.js -r v8,console-summary --lcov | ||
``` | ||
- Current working directory mode | ||
- Locally in your project | ||
```sh | ||
npm i monocart-coverage-reports | ||
npx mcr "node ./test/test-node-env.js" -r v8,console-summary --lcov | ||
npx mcr node ./test/test-node-env.js -r v8,console-summary --lcov | ||
``` | ||
@@ -297,3 +297,3 @@ - CLI Options | ||
``` | ||
- Supports loading default configuration file | ||
- Loading default configuration file | ||
- `.mcrrc` | ||
@@ -304,5 +304,5 @@ - `mcr.config.json` | ||
- `mcr.config.js` | ||
- Specify custom configuration file | ||
- Or loading custom configuration file with `-c` or `--config` | ||
```sh | ||
mcr "node ./test.js" -c path-to/my-custom-config.js | ||
mcr node ./test.js -c path-to/my-custom-config.js | ||
``` | ||
@@ -309,0 +309,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
756544
7774