diff --git a/README.md b/README.md index f26029720..587a503a6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ _Having problems? want to contribute? join our [community slack](http://devtools Istanbul's state of the art command line interface, with support for: * applications that spawn subprocesses. -* ES2015 transforms, via [babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul), or source-maps. +* ES2015 transforms, via [`babel-plugin-istanbul`], or source-maps. ## Instrumenting your code @@ -62,10 +62,8 @@ stack traces for instrumented code will reflect their original lines. ### Support for custom require hooks (babel, typescript, etc.) -nyc supports custom require hooks like -[`babel-register`](http://babeljs.io/docs/usage/require/). nyc can -load the hooks for you, [using the `--require` -flag](#require-additional-modules). +nyc supports custom require hooks like [`@babel/register`]. nyc can load +the hooks for you, [using the `--require` flag](#require-additional-modules). Source maps are used to map coverage information back to the appropriate lines of the pre-transpiled code. You'll have to configure your custom require hook @@ -75,8 +73,8 @@ the `sourceMaps` option to `inline`. ### Source-Map support for pre-instrumented codebases If you opt to pre-instrument your source-code (rather than using a just-in-time -transpiler like [`babel-register`](http://babeljs.io/docs/usage/require/)) -nyc supports both inline source-maps and `.map` files. +transpiler like [`@babel/register`]) nyc supports both inline source-maps and +`.map` files. _Important: If you are using nyc with a project that pre-instruments its code, run nyc with the configuration option `--exclude-after-remap` set to `false`. @@ -85,15 +83,14 @@ covered under exclude rules._ ## Use with `babel-plugin-istanbul` for Babel Support -We recommend using [`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul) if your -project uses the babel tool chain: +We recommend using [`babel-plugin-istanbul`] if your project uses the babel tool chain: 1. enable the `babel-plugin-istanbul` plugin: ```json { "babel": { - "presets": ["env"], + "presets": ["@babel/env"], "env": { "test": { "plugins": ["istanbul"] @@ -114,7 +111,7 @@ project uses the babel tool chain: { "nyc": { "require": [ - "babel-register" + "@babel/register" ], "sourceMap": false, "instrument": false @@ -251,7 +248,7 @@ an `include` key with a list of globs to specify specific files that should be c The `--require` flag can be provided to `nyc` to indicate that additional modules should be required in the subprocess collecting coverage: -`nyc --require babel-register --require babel-polyfill mocha` +`nyc --require @babel/register --require @babel/polyfill mocha` ## Caching @@ -450,3 +447,6 @@ You can find more tutorials at http://istanbul.js.org/docs/tutorials ## Other advanced features 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). + +[`@babel/register`]: https://www.npmjs.com/package/@babel/register +[`babel-plugin-istanbul`]: https://github.com/istanbuljs/babel-plugin-istanbul diff --git a/index.js b/index.js index dded71d33..3695b0cee 100755 --- a/index.js +++ b/index.js @@ -423,7 +423,7 @@ NYC.prototype.getCoverageMapFromAllCoverageFiles = function (baseDirectory) { map.merge(report) }, baseDirectory) // depending on whether source-code is pre-instrumented - // or instrumented using a JIT plugin like babel-require + // or instrumented using a JIT plugin like @babel/require // you may opt to exclude files after applying // source-map remapping logic. if (this.config.excludeAfterRemap) { diff --git a/lib/commands/instrument.js b/lib/commands/instrument.js index b24c0bb56..7c098d9a2 100644 --- a/lib/commands/instrument.js +++ b/lib/commands/instrument.js @@ -14,7 +14,7 @@ exports.builder = function (yargs) { .option('require', { alias: 'i', default: [], - describe: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., babel-register, babel-polyfill.' + describe: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill.' }) .option('extension', { alias: 'e', diff --git a/lib/config-util.js b/lib/config-util.js index 62e1af1d0..1b28392bc 100644 --- a/lib/config-util.js +++ b/lib/config-util.js @@ -93,7 +93,7 @@ Config.buildYargs = function (cwd) { .option('require', { alias: 'i', default: [], - describe: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., babel-register, babel-polyfill', + describe: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill', global: false }) .option('eager', { @@ -235,7 +235,7 @@ Config.buildYargs = function (cwd) { }) .pkgConf('nyc', cwd) .example('$0 npm test', 'instrument your tests with coverage') - .example('$0 --require babel-core/register npm test', 'instrument your tests with coverage and transpile with Babel') + .example('$0 --require @babel/register npm test', 'instrument your tests with coverage and transpile with Babel') .example('$0 report --reporter=text-lcov', 'output lcov report after running your tests') .epilog('visit https://git.io/vHysA for list of available reporters') .boolean('h') diff --git a/package.json b/package.json index 56db8550e..d49af3a0c 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,9 @@ "which": "^1.3.1", "zero-fill": "^2.2.3" }, + "engines": { + "node": ">=6" + }, "repository": { "type": "git", "url": "git@github.com:istanbuljs/nyc.git"