Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Here is a list of common options. Run `c8 --help` for the full list and document
| `--per-file` | check thresholds per file | `boolean` | `false` |
| `--temp-directory` | directory V8 coverage data is written to and read from | `string` | `process.env.NODE_V8_COVERAGE` |
| `--clean` | should temp files be deleted before script execution | `boolean` | `true` |
| `--print-config` | prints the derived configuration between defaults and a detected configuration file or a file passed as an argument | `boolean` | `false`
| `--print-config-format` | format in which to print the derived configuration. Either text or json. | `string` | `text`

## Checking for "full" source coverage using `--all`

Expand Down
19 changes: 18 additions & 1 deletion lib/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const { applyExtends } = require('yargs/helpers')
const parser = require('yargs-parser')
const { resolve } = require('path')

const { printConfig } = require('./print-config.js')

function buildYargs (withCommands = false) {
const yargs = Yargs([])
.usage('$0 [opts] [script] [opts]')
Expand Down Expand Up @@ -158,8 +160,19 @@ function buildYargs (withCommands = false) {
describe: 'supplying --merge-async will merge all v8 coverage reports asynchronously and incrementally. ' +
'This is to avoid OOM issues with Node.js runtime.'
})
.options('print-config', {
default: false,
type: 'boolean',
describe: 'Print the derived configuration between command line parameters and loaded configuration file'
})
// Todo: refactor. Use parse-args options.
.options('print-config-format', {
default: 'text',
Comment thread
mcknasty marked this conversation as resolved.
type: 'string',
choices: ['text', 'json'],
describe: 'Format to print the configuration in. Accepted formats are either text or json'
})
.pkgConf('c8')
.demandCommand(1)
.check((argv) => {
if (!argv.tempDirectory) {
argv.tempDirectory = resolve(argv.reportsDir, 'tmp')
Expand All @@ -181,6 +194,10 @@ function buildYargs (withCommands = false) {
// }
// })

printConfig(yargs, hideInstrumenteeArgs)

yargs.demandCommand(1)

const checkCoverage = require('./commands/check-coverage')
const report = require('./commands/report')
if (withCommands) {
Expand Down
Loading