diff --git a/README.md b/README.md index 43bfcb923..79910ec01 100644 --- a/README.md +++ b/README.md @@ -191,10 +191,10 @@ and anything in the `build` directory: } } ``` -> Note: Since version 8.0 if you add a "exclude" array the `node_modules` -folder is not automatically excluded, you will need to explicitly add it to your exclude array +> Note: Since version 9.0 files under `node_modules/` are excluded by default. + add the exclude rule `!**/node_modules/` to stop this. -> Note: exclude defaults to `['test', 'test{,-*}.js', '**/*.test.js', '**/__tests__/**']`, +> Note: exclude defaults to `['test', 'test{,-*}.js', '**/*.test.js', '**/__tests__/**', '**/node_modules/**']`, which would exclude `test`/`__tests__` directories as well as `test.js`, `*.test.js`, and `test-*.js` files. Specifying your own exclude property overrides these defaults. diff --git a/package.json b/package.json index f3387e0ec..486c2e5d5 100644 --- a/package.json +++ b/package.json @@ -83,9 +83,9 @@ "glob": "^7.0.6", "istanbul-lib-coverage": "^1.0.0", "istanbul-lib-hook": "^1.0.0-alpha.4", - "istanbul-lib-instrument": "^1.2.0", + "istanbul-lib-instrument": "^1.3.0", "istanbul-lib-report": "^1.0.0-alpha.3", - "istanbul-lib-source-maps": "^1.0.2", + "istanbul-lib-source-maps": "^1.1.0", "istanbul-reports": "^1.0.0", "md5-hex": "^1.2.0", "merge-source-map": "^1.0.2", @@ -95,7 +95,7 @@ "rimraf": "^2.5.4", "signal-exit": "^3.0.1", "spawn-wrap": "^1.2.4", - "test-exclude": "^2.1.3", + "test-exclude": "^3.0.0", "yargs": "^6.0.0", "yargs-parser": "^4.0.2" }, @@ -157,4 +157,4 @@ "find-up" ] } -} \ No newline at end of file +} diff --git a/test/src/nyc-test.js b/test/src/nyc-test.js index 184e83945..7dd142301 100644 --- a/test/src/nyc-test.js +++ b/test/src/nyc-test.js @@ -66,7 +66,7 @@ describe('nyc', function () { describe('config', function () { it("loads 'exclude' patterns from package.json#nyc", function () { var nyc = new NYC(configUtil.loadConfig([], path.resolve(__dirname, '../fixtures'))) - nyc.exclude.exclude.length.should.eql(4) + nyc.exclude.exclude.length.should.eql(5) }) it("loads 'extension' patterns from package.json#nyc", function () { @@ -97,14 +97,14 @@ describe('nyc', function () { it("allows for empty 'exclude'", function () { var nyc2 = new NYC({exclude: []}) - nyc2.exclude.exclude.length.should.eql(0) + // an empty exclude still has !**/node_modules/** added. + nyc2.exclude.exclude.length.should.eql(1) }) }) describe('shouldInstrumentFile', function () { it('should exclude appropriately with defaults', function () { var nyc = new NYC(configUtil.loadConfig([ - '--exclude=**/node_modules/**', '--exclude=test/**', '--exclude=test{,-*}.js', '--exclude=**/*.test.js',