Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: istanbuljs/nyc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fe3311bd4770726c67e6eee1e39b15a3b616457b
Choose a base ref
...
head repository: istanbuljs/nyc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bebf4d68c6a2cb0c5fd66ba3513a8e68ad5a284f
Choose a head ref
Loading
Showing with 7,827 additions and 6,670 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE.md
  2. +2 −0 .github/stale.yml
  3. +8 −0 .taprc
  4. +3 −2 .travis.yml
  5. +35 −1 CHANGELOG.md
  6. +19 −15 README.md
  7. +80 −53 bin/nyc.js
  8. +3 −26 bin/wrap.js
  9. +2 −0 build-self-coverage.js
  10. +4 −2 docs/instrument.md
  11. +154 −231 index.js
  12. +10 −59 lib/commands/check-coverage.js
  13. +74 −0 lib/commands/helpers.js
  14. +32 −100 lib/commands/instrument.js
  15. +18 −26 lib/commands/merge.js
  16. +11 −91 lib/commands/report.js
  17. +35 −267 lib/config-util.js
  18. +51 −0 lib/fs-promises.js
  19. +14 −18 lib/instrumenters/istanbul.js
  20. +4 −3 lib/instrumenters/noop.js
  21. +4 −2 lib/process-args.js
  22. +0 −92 lib/process.js
  23. +27 −0 lib/register-env.js
  24. +67 −43 lib/source-maps.js
  25. +28 −0 lib/wrap.js
  26. +19 −0 npm-run-clean.js
  27. +22 −0 nyc.config.js
  28. +4,448 −1,882 package-lock.json
  29. +37 −54 package.json
  30. +22 −11 self-coverage-helper.js
  31. +7 −7 tap-snapshots/test-config-override.js-TAP.test.js
  32. +16 −0 tap-snapshots/test-eager.js-TAP.test.js
  33. +17 −0 tap-snapshots/test-instrument.js-TAP.test.js
  34. +550 −169 tap-snapshots/test-nyc-integration.js-TAP.test.js
  35. +26 −0 tap-snapshots/test-tsc.js-TAP.test.js
  36. +127 −0 test/add-all-files.js
  37. +35 −0 test/cache.js
  38. +85 −0 test/config.js
  39. +39 −0 test/cwd.js
  40. +30 −0 test/eager.js
  41. +0 −71 test/fixtures/_generateReport.js
  42. +1 −1 test/fixtures/cli/external-instrumenter.js
  43. +5 −0 test/fixtures/cli/instrument-inplace/file1.js
  44. +5 −0 test/fixtures/cli/instrument-inplace/file2.js
  45. +1 −0 test/fixtures/cli/instrument-inplace/package.json
  46. +2 −0 test/fixtures/cli/selfspawn-fibonacci.js
  47. +4 −0 test/fixtures/conf-multiple-extensions/run.js
  48. +5 −0 test/fixtures/eager.js
  49. +9 −0 test/fixtures/hooks/run-in-context.js
  50. +4 −0 test/fixtures/nyc.config.js
  51. +3 −0 test/fixtures/parser-plugins/no-plugins.json
  52. +7 −0 test/fixtures/parser-plugins/package.json
  53. +2 −0 test/fixtures/parser-plugins/v8.js
  54. +0 −793 test/fixtures/report.js
  55. +1 −0 test/fixtures/tsc/.npmrc
  56. +16 −0 test/fixtures/tsc/mapping.js
  57. +1 −0 test/fixtures/tsc/mapping.js.map
  58. +8 −0 test/fixtures/tsc/mapping.ts
  59. +15 −0 test/fixtures/tsc/package.json
  60. +8 −0 test/fixtures/tsc/tsconfig.json
  61. +29 −0 test/helpers/env-check-config.js
  62. +5 −1 test/helpers/index.js
  63. +11 −0 test/helpers/parse-argv.js
  64. +16 −7 test/helpers/reset-state.js
  65. +15 −6 test/helpers/run-nyc.js
  66. +3 −0 test/helpers/source-map-support.js
  67. +2 −0 test/helpers/spawn.js
  68. +5 −7 test/helpers/temp-dir-setup.js
  69. +8 −6 test/helpers/test-failure.js
  70. +8 −6 test/helpers/test-success.js
  71. +355 −0 test/instrument.js
  72. +58 −0 test/issue-190.js
  73. +0 −533 test/nyc-index.js
  74. +0 −1,402 test/nyc-integration-old.js
  75. +536 −57 test/nyc-integration.js
  76. +29 −0 test/parser-plugins.js
  77. +64 −65 test/process-args.js
  78. +34 −43 test/processinfo.js
  79. +52 −0 test/report.js
  80. +76 −0 test/should-instrument.js
  81. +37 −0 test/source-map-support.js
  82. +0 −517 test/src/nyc-tap.js
  83. +81 −0 test/temp-dir.js
  84. +28 −0 test/tsc.js
  85. +112 −0 test/wrap.js
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ create a basic `nyc-bug-demo` repository and link to that please [mandatory].
## Observed Behavior

### Troubleshooting steps
- [ ] still occurrring when I put `cache: false` in my nyc config
- [ ] still occurring when I put `cache: false` in my nyc config

## Environment Information
<!--
2 changes: 2 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
daysUntilStale: 365

exemptLabels:
- "Great First Contribution"
- pinned
8 changes: 8 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"test-ignore": "^test/(helpers|src)/",
"coverage": false,
"jobs": 1,
"timeout": 360,
"bail": false,
"esm": false
}
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -7,16 +7,17 @@ node_js:
- "node"
- 10
- 8
- 6
matrix:
## An ENOMEM error occurs with 11.6.0 under Travis-CI for Windows.
## An ENOMEM error occurs with 10+ under Travis-CI for Windows.
## Disable until we can determine the cause.
# include:
# - os: windows
# node_js: "latest"
exclude:
- os: windows
node_js: "node"
- os: windows
node_js: 10
git:
depth:
1
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# Change Log
# Changelog

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.

## [15.0.0](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) (2019-12-20)


### ⚠ BREAKING CHANGES

* The `flow` and `jsx` parser plugins are no longer
enabled by default.
* Node.js 8 is now required to run nyc
* Remove NYC_ROOT_ID and NYC_INSTRUMENTER environmental
variables.
* The `root` field has been removed from processinfo
files.

### Features

* Add `--use-spawn-wrap=true` option ([#1169](https://github.com/istanbuljs/nyc/issues/1169)) ([df4de4d](https://github.com/istanbuljs/nyc/commit/df4de4d490f8cd32204fba66a810ed0444c26d0d))
* Add `.cjs`, `.mjs`, `.ts`, `.tsx`, `.jsx` to default extensions ([#1110](https://github.com/istanbuljs/nyc/issues/1110)) ([914b776](https://github.com/istanbuljs/nyc/commit/914b776215ad3ea54f0e46b4ba2904a8a9d4dfdd)), closes [#1103](https://github.com/istanbuljs/nyc/issues/1103)
* Allow `nyc instrument` to instrument code in place ([#1149](https://github.com/istanbuljs/nyc/issues/1149)) ([7783284](https://github.com/istanbuljs/nyc/commit/77832845b85134d21eca3a23c812c4f21f36713f))
* Drop node.js 6, upgrade dependencies ([#1134](https://github.com/istanbuljs/nyc/issues/1134)) ([00c3b34](https://github.com/istanbuljs/nyc/commit/00c3b3440a5b2ffe11b9c19ae4e08ad2f5b70e33))
* Filenames relative to project cwd in coverage reports ([#1212](https://github.com/istanbuljs/nyc/issues/1212)) ([5258e9f](https://github.com/istanbuljs/nyc/commit/5258e9fdb1d9e3d4abd4cc9768bc09cd8040a6be))
* Use @istanbuljs/schema for yargs setup ([#1194](https://github.com/istanbuljs/nyc/issues/1194)) ([fd40d49](https://github.com/istanbuljs/nyc/commit/fd40d49331665d936b86f30e9a873ba80071b770))
* Use istanbul-lib-processinfo ([#1145](https://github.com/istanbuljs/nyc/issues/1145)) ([7943413](https://github.com/istanbuljs/nyc/commit/7943413dc032f8f98a164fdde88d7344e817bb5e))
* Use source base name to prefix cache files ([#1144](https://github.com/istanbuljs/nyc/issues/1144)) ([5c1b7a9](https://github.com/istanbuljs/nyc/commit/5c1b7a9c43771f3439af44a1104e5426519e1123))


### Bug Fixes

* Avoid `source-map` module during `signal-exit` handler ([#1191](https://github.com/istanbuljs/nyc/issues/1191)) ([83eb629](https://github.com/istanbuljs/nyc/commit/83eb6294f9492bf98405ee9fdf6281c3bc199a3d))
* Better error handling for main execution, reporting ([#1229](https://github.com/istanbuljs/nyc/issues/1229)) ([dfd629d](https://github.com/istanbuljs/nyc/commit/dfd629d95716e6159aa7216c03e28a7fbbb161e7))
* Correct handling of source-maps for pre-instrumented files ([#1216](https://github.com/istanbuljs/nyc/issues/1216)) ([8411a26](https://github.com/istanbuljs/nyc/commit/8411a26c9e520c66251cc8044cde2c81f33f1c5f)), closes [#1208](https://github.com/istanbuljs/nyc/issues/1208)
* Drop coverage produced by `nyc --all` for files that were tested ([#1155](https://github.com/istanbuljs/nyc/issues/1155)) ([fc1bbbf](https://github.com/istanbuljs/nyc/commit/fc1bbbf490f6ab0272359ce10ceb4987d1716256)), closes [#1113](https://github.com/istanbuljs/nyc/issues/1113) [#1124](https://github.com/istanbuljs/nyc/issues/1124) [#1148](https://github.com/istanbuljs/nyc/issues/1148)
* Honor eager setting (false by default) ([#1179](https://github.com/istanbuljs/nyc/issues/1179)) ([c18fb0a](https://github.com/istanbuljs/nyc/commit/c18fb0a9a8eae5904298d87c62d9934243de8674))
* Remove vestigial environment variables ([#1078](https://github.com/istanbuljs/nyc/issues/1078)) ([cfd3da0](https://github.com/istanbuljs/nyc/commit/cfd3da05156b98952f03f7be2dd3d23ba328073f))

## [14.1.1](https://github.com/istanbuljs/nyc/compare/v14.1.0...v14.1.1) (2019-05-09)


34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
[![Coverage Status](https://coveralls.io/repos/istanbuljs/nyc/badge.svg?branch=)](https://coveralls.io/r/istanbuljs/nyc?branch=master)
[![NPM version](https://img.shields.io/npm/v/nyc.svg)](https://www.npmjs.com/package/nyc)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![community slack](https://devtoolscommunity.herokuapp.com/badge.svg)](http://devtoolscommunity.herokuapp.com)
[![community slack](https://devtoolscommunity.herokuapp.com/badge.svg)](https://devtoolscommunity.herokuapp.com)

_Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com)_.
_Having problems? want to contribute? join our [community slack](https://devtoolscommunity.herokuapp.com)_.

Istanbul's state of the art command line interface, with support for:

@@ -78,7 +78,7 @@ You can then add the specific configuration options you want that aren't in that

### Configuration files

Any configuration options that can be set via the command line can also be specified in the `nyc` stanza of your package.json, or within a seperate configuration file - a variety of flavors are available:
Any configuration options that can be set via the command line can also be specified in the `nyc` stanza of your package.json, or within a separate configuration file - a variety of flavors are available:

| File name | File Association |
|-----------------|------------------|
@@ -98,18 +98,18 @@ This table is a quick TLDR for the rest of this readme and there are more advanc
| ----------- | ----------- | ---- | ------- |
| `all` | Whether or not to instrument all files (not just the ones touched by your test suite) | `Boolean` | `false` |
| `check-coverage` | Check whether coverage is within thresholds, fail if not | `Boolean` | `false` |
| `extension` | List of extensions that nyc should attempt to handle in addition to `.js` | `Array<String>` | `['.js']` |
| `extension` | List of extensions that nyc should attempt to handle in addition to `.js` | `Array<String>` | `['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx']` |
| `include` | See [selecting files for coverage] for more info | `Array<String>` | `['**']`|
| `exclude` | See [selecting files for coverage] for more info | `Array<String>` | [list](https://github.com/istanbuljs/istanbuljs/blob/master/packages/test-exclude/default-exclude.js) |
| `exclude` | See [selecting files for coverage] for more info | `Array<String>` | [list](https://github.com/istanbuljs/schema/blob/master/default-exclude.js) |
| `reporter` | [Coverage reporters to use](https://istanbul.js.org/docs/advanced/alternative-reporters/) | `Array<String>` | `['text']` |
| `report-dir` | Where to put the coverage report files | `String` | `./coverage` |
| `skip-full` | Don't show files with 100% statement, branch, and function coverage | `Boolean` | `false` |
| `temp-dir` | Directory to output raw coverage information to | `String` | `./.nyc_output` |

Configuration can also be provided by `nyc.config.js` if programmed logic is required:
```js
'use strict';
const {defaultExclude} = require('test-exclude');
'use strict';
const defaultExclude = require('@istanbuljs/schema/default-exclude');
const isWindows = require('is-windows');

let platformExclude = [
@@ -142,13 +142,13 @@ module.exports = {

By default, nyc only collects coverage for source files that are visited during a test.
It does this by watching for files that are `require()`'d during the test.
When a file is `require()`'d, nyc creates and returns an instrumented version of the source, rather than the original.
When a file is `require()`'d, nyc creates and returns an instrumented version of the source, rather than the original.
Only source files that are visited during a test will appear in the coverage report and contribute to coverage statistics.

nyc will instrument all files if the `--all` flag is set or if running `nyc instrument`.
In this case all files will appear in the coverage report and contribute to coverage statistics.

nyc will only collect coverage for files that are located under `cwd`, and then only `*.js` files or files with extensions listed in the `extension` array.
nyc will only collect coverage for files that are located under `cwd`, and then only files with extensions listed in the `extension` array.

You can reduce the set of instrumented files by adding `include` and `exclude` filter arrays to your config.
These allow you to shape the set of instrumented files by specifying glob patterns that can filter files from the default instrumented set.
@@ -172,7 +172,7 @@ You can also specify negated paths in the `exclude` array, by prefixing them wit
Negated paths can restore paths that have been already been excluded in the `exclude` array.
Multiple `exclude` globs can be specified on the command line, each must follow a `--exclude`, `-x` switch.

The default `exclude` list is defined in the [test-exclude module](https://github.com/istanbuljs/istanbuljs/blob/master/packages/test-exclude/default-exclude.js).
The default `exclude` list is defined in the [@istanbuljs/schema module](https://github.com/istanbuljs/schema/blob/master/default-exclude.js).
Specifying your own exclude property completely replaces these defaults.

For example, the following config will collect coverage for every file in the `src` directory regardless of whether it is `require()`'d in a test.
@@ -200,7 +200,7 @@ To prevent this, wrap each glob in single quotes.
We always add `**/node_modules/**` to the exclude list, even if not specified in the config.
You can override this by setting `--exclude-node-modules=false`.

For example, in the following config, `"excludeNodeModules: false"` will prevent `node_modules` from being added to the exclude rules.
For example, in the following config, `"excludeNodeModules: false"` will prevent `node_modules` from being added to the exclude rules.
The set of include rules then restrict nyc to only consider instrumenting files found under the `lib/` and `node_modules/@my-org/` directories.
The exclude rules then prevent nyc instrumenting anything in a `test` folder and the file `node_modules/@my-org/something/unwanted.js`.

@@ -371,13 +371,17 @@ Otherwise nyc's reports will exclude any files that source-maps remap to folders

Many testing frameworks (Mocha, Tape, Tap, etc.) can produce [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol) output. [tap-nyc](https://github.com/MegaArman/tap-nyc) is a TAP formatter designed to look nice with nyc.

## More tutorials
## Tutorials and Advanced Documentation

You can find more tutorials at http://istanbul.js.org/docs/tutorials
See [more nyc tutorials](https://istanbul.js.org/docs/tutorials) and [advanced nyc documentation](https://istanbul.js.org/docs/advanced/).

## Other advanced features
Please feel free to [contribute documentation](https://github.com/istanbuljs/istanbuljs.github.io/tree/development/content) to help us improve.

Take a look at http://istanbul.js.org/docs/advanced/ and please feel free to [contribute documentation](https://github.com/istanbuljs/istanbuljs.github.io/tree/development/content).
## `nyc` for enterprise

Available as part of the Tidelift Subscription.

The maintainers of `nyc` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-nyc?utm_source=npm-nyc&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

[`@babel/register`]: https://www.npmjs.com/package/@babel/register
[`babel-plugin-istanbul`]: https://github.com/istanbuljs/babel-plugin-istanbul
133 changes: 80 additions & 53 deletions bin/nyc.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,118 @@
#!/usr/bin/env node
'use strict'

const configUtil = require('../lib/config-util')
const { cliWrapper, suppressEPIPE } = require('../lib/commands/helpers')
const foreground = require('foreground-child')
const resolveFrom = require('resolve-from')
const NYC = require('../index.js')
const processArgs = require('../lib/process-args')

const sw = require('spawn-wrap')
const wrapper = require.resolve('./wrap.js')

// parse configuration and command-line arguments;
// we keep these values in a few different forms,
// used in the various execution contexts of nyc:
// reporting, instrumenting subprocesses, etc.
const yargs = configUtil.buildYargs()
const instrumenterArgs = processArgs.hideInstrumenteeArgs()
const config = configUtil.loadConfig(yargs.parse(instrumenterArgs))
configUtil.addCommandsAndHelp(yargs)
const argv = yargs.config(config).parse(instrumenterArgs)

if ([
'check-coverage', 'report', 'instrument', 'merge'
].indexOf(argv._[0]) !== -1) {
// look in lib/commands for logic.
} else if (argv._.length) {

async function main () {
const { argv, childArgs, yargs } = await configUtil()

if (['check-coverage', 'report', 'instrument', 'merge'].includes(argv._[0])) {
// look in lib/commands for logic.
return
}

if (argv._.length === 0) {
// I don't have a clue what you're doing.
process.exitCode = 1
yargs.showHelp()
return
}

// if instrument is set to false,
// enable a noop instrumenter.
if (!argv.instrument) argv.instrumenter = './lib/instrumenters/noop'
else argv.instrumenter = './lib/instrumenters/istanbul'

var nyc = (new NYC(argv))
if (argv.clean) {
nyc.reset()
await nyc.reset()
} else {
nyc.createTempDirectory()
await nyc.createTempDirectory()
}
if (argv.all) nyc.addAllFiles()

var env = {
// Support running nyc as a user without HOME (e.g. linux 'nobody'),
// https://github.com/istanbuljs/nyc/issues/951
SPAWN_WRAP_SHIM_ROOT: process.env.SPAWN_WRAP_SHIM_ROOT || process.env.XDG_CACHE_HOME || require('os').homedir(),
const env = {
NYC_CONFIG: JSON.stringify(argv),
NYC_CWD: process.cwd(),
NYC_ROOT_ID: nyc.rootId,
NYC_INSTRUMENTER: argv.instrumenter
NYC_CWD: process.cwd()
}

/* istanbul ignore else */
if (argv['babel-cache'] === false) {
// babel's cache interferes with some configurations, so is
// disabled by default. opt in by setting babel-cache=true.
env.BABEL_DISABLE_CACHE = process.env.BABEL_DISABLE_CACHE = '1'
}

sw([wrapper], env)
if (!argv.useSpawnWrap) {
const requireModules = [
require.resolve('../lib/register-env.js'),
...nyc.require.map(mod => resolveFrom.silent(nyc.cwd, mod) || mod)
]
const preloadList = require('node-preload')
preloadList.push(
...requireModules,
require.resolve('../lib/wrap.js')
)

Object.assign(process.env, env)
requireModules.forEach(mod => {
require(mod)
})
}

if (argv.all) {
await nyc.addAllFiles()
}

if (argv.useSpawnWrap) {
const wrapper = require.resolve('./wrap.js')
// Support running nyc as a user without HOME (e.g. linux 'nobody'),
// https://github.com/istanbuljs/nyc/issues/951
env.SPAWN_WRAP_SHIM_ROOT = process.env.SPAWN_WRAP_SHIM_ROOT || process.env.XDG_CACHE_HOME || require('os').homedir()
const sw = require('spawn-wrap')

sw([wrapper], env)
}

// Both running the test script invocation and the check-coverage run may
// set process.exitCode. Keep track so that both children are run, but
// a non-zero exit codes in either one leads to an overall non-zero exit code.
process.exitCode = 0
foreground(processArgs.hideInstrumenterArgs(
// use the same argv descrption, but don't exit
// for flags like --help.
configUtil.buildYargs().parse(process.argv.slice(2))
), function (done) {
var mainChildExitCode = process.exitCode

nyc.writeProcessIndex()

nyc.maybePurgeSourceMapCache()
if (argv.checkCoverage) {
nyc.checkCoverage({
lines: argv.lines,
functions: argv.functions,
branches: argv.branches,
statements: argv.statements
}, argv['per-file'])
process.exitCode = process.exitCode || mainChildExitCode
}
foreground(childArgs, async () => {
const mainChildExitCode = process.exitCode

if (!argv.silent) {
nyc.report()
}
try {
await nyc.writeProcessIndex()

nyc.maybePurgeSourceMapCache()
if (argv.checkCoverage) {
await nyc.checkCoverage({
lines: argv.lines,
functions: argv.functions,
branches: argv.branches,
statements: argv.statements
}, argv['per-file']).catch(suppressEPIPE)
process.exitCode = process.exitCode || mainChildExitCode
}

return done()
if (!argv.silent) {
await nyc.report().catch(suppressEPIPE)
}
} catch (error) {
/* istanbul ignore next */
process.exitCode = process.exitCode || mainChildExitCode || 1
/* istanbul ignore next */
console.error(error.message)
}
})
} else {
// I don't have a clue what you're doing.
process.exitCode = 1
yargs.showHelp()
}

cliWrapper(main)()
29 changes: 3 additions & 26 deletions bin/wrap.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
var sw = require('spawn-wrap')
var NYC = require('../index.js')
'use strict'

var config = {}
if (process.env.NYC_CONFIG) config = JSON.parse(process.env.NYC_CONFIG)
config.isChildProcess = true

config._processInfo = {
pid: process.pid,
ppid: process.ppid,
parent: process.env.NYC_PROCESS_ID || null,
root: process.env.NYC_ROOT_ID
}
if (process.env.NYC_PROCESSINFO_EXTERNAL_ID) {
config._processInfo.externalId = process.env.NYC_PROCESSINFO_EXTERNAL_ID
delete process.env.NYC_PROCESSINFO_EXTERNAL_ID
}

if (process.env.NYC_CONFIG_OVERRIDE) {
var override = JSON.parse(process.env.NYC_CONFIG_OVERRIDE)
config = Object.assign(config, override)
process.env.NYC_CONFIG = JSON.stringify(config)
}

;(new NYC(config)).wrap()

sw.runMain()
require('../lib/wrap')
require('spawn-wrap').runMain()
2 changes: 2 additions & 0 deletions build-self-coverage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const path = require('path')
const fs = require('fs')
const istanbul = require('istanbul-lib-instrument')
Loading