c8 7.10.0 → 7.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [7.11.0](https://github.com/bcoe/c8/compare/v7.10.0...v7.11.0) (2021-12-30)
6
+
7
+
8
+ ### Features
9
+
10
+ * add --extension option ([#331](https://github.com/bcoe/c8/issues/331)) ([ff01cd8](https://github.com/bcoe/c8/commit/ff01cd832a155494892b24c30c5a1c8f0169fd8e))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **config:** support configuration inheritance ([#343](https://github.com/bcoe/c8/issues/343)) ([e81ed5d](https://github.com/bcoe/c8/commit/e81ed5dd9ef5dac1a1f2f6dc26a07abb6c05d709))
16
+
5
17
  ## [7.10.0](https://www.github.com/bcoe/c8/compare/v7.9.0...v7.10.0) (2021-10-06)
6
18
 
7
19
 
package/README.md CHANGED
@@ -35,7 +35,8 @@ Here is a list of common options. Run `c8 --help` for the full list and document
35
35
  | `--all` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `boolean` | `false` |
36
36
  | `--src` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | `[process.cwd()]`|
37
37
  | `-n`, `--include` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | `[]` (include all files) |
38
- | `-x`, `--exclude` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | [list](https://github.com/istanbuljs/schema/blob/main/default-exclude.js) |
38
+ | `-x`, `--exclude` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | [list](https://github.com/istanbuljs/schema/blob/master/default-exclude.js) |
39
+ | `-e`, `--extension` | only files matching these extensions will show coverage | `string | Array<string>` | [list](https://github.com/istanbuljs/schema/blob/master/default-extension.js) |
39
40
  | `--skip-full` | do not show files with 100% statement, branch, and function coverage | `boolean` | `false` |
40
41
  | `--check-coverage` | check whether coverage is within thresholds provided | `boolean` | `false` |
41
42
  | `--temp-directory` | directory V8 coverage data is written to and read from | `string` | `process.env.NODE_V8_COVERAGE` |
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export type Watermark = [number, number];
3
3
  export declare class Report {
4
4
  constructor(opts: {
5
5
  exclude?: string | string[],
6
+ extension?: string | string[],
6
7
  excludeAfterRemap?: boolean,
7
8
  include?: string | string[],
8
9
  reporter: string[],
@@ -22,6 +22,7 @@ exports.handler = function (argv) {
22
22
  const report = Report({
23
23
  include: argv.include,
24
24
  exclude: argv.exclude,
25
+ extension: argv.extension,
25
26
  reporter: Array.isArray(argv.reporter) ? argv.reporter : [argv.reporter],
26
27
  reportsDirectory: argv['reports-dir'],
27
28
  tempDirectory: argv.tempDirectory,
@@ -21,6 +21,7 @@ exports.outputReport = async function (argv) {
21
21
  const report = Report({
22
22
  include: argv.include,
23
23
  exclude: argv.exclude,
24
+ extension: argv.extension,
24
25
  excludeAfterRemap: argv.excludeAfterRemap,
25
26
  reporter: Array.isArray(argv.reporter) ? argv.reporter : [argv.reporter],
26
27
  reportsDirectory: argv['reports-dir'],
package/lib/parse-args.js CHANGED
@@ -1,7 +1,9 @@
1
1
  const defaultExclude = require('@istanbuljs/schema/default-exclude')
2
+ const defaultExtension = require('@istanbuljs/schema/default-extension')
2
3
  const findUp = require('find-up')
3
4
  const { readFileSync } = require('fs')
4
5
  const Yargs = require('yargs/yargs')
6
+ const { applyExtends } = require('yargs/helpers')
5
7
  const parser = require('yargs-parser')
6
8
  const { resolve } = require('path')
7
9
 
@@ -12,7 +14,10 @@ function buildYargs (withCommands = false) {
12
14
  alias: 'c',
13
15
  config: true,
14
16
  describe: 'path to JSON configuration file',
15
- configParser: (path) => JSON.parse(readFileSync(path)),
17
+ configParser: (path) => {
18
+ const config = JSON.parse(readFileSync(path))
19
+ return applyExtends(config, process.cwd(), true)
20
+ },
16
21
  default: () => findUp.sync(['.c8rc', '.c8rc.json', '.nycrc', '.nycrc.json'])
17
22
  })
18
23
  .option('reporter', {
@@ -58,6 +63,12 @@ function buildYargs (withCommands = false) {
58
63
  group: 'Reporting options',
59
64
  describe: 'a list of specific files and directories that should be excluded from coverage (glob patterns are supported)'
60
65
  })
66
+ .option('extension', {
67
+ alias: 'e',
68
+ default: defaultExtension,
69
+ group: 'Reporting options',
70
+ describe: 'a list of specific file extensions that should be covered'
71
+ })
61
72
  .option('exclude-after-remap', {
62
73
  alias: 'a',
63
74
  type: 'boolean',
package/lib/report.js CHANGED
@@ -15,6 +15,7 @@ const debuglog = util.debuglog('c8')
15
15
  class Report {
16
16
  constructor ({
17
17
  exclude,
18
+ extension,
18
19
  excludeAfterRemap,
19
20
  include,
20
21
  reporter,
@@ -38,6 +39,7 @@ class Report {
38
39
  this.exclude = new Exclude({
39
40
  exclude: exclude,
40
41
  include: include,
42
+ extension: extension,
41
43
  relativePath: !allowExternal,
42
44
  excludeNodeModules: excludeNodeModules
43
45
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8",
3
- "version": "7.10.0",
3
+ "version": "7.11.0",
4
4
  "description": "output coverage reports using Node.js' built in coverage",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",