Skip to content

Commit

Permalink
feat: node_modules is again excluded by default when custom exclude i…
Browse files Browse the repository at this point in the history
…s provided (#442)

BREAKING CHANGE: **/node_modules/** is again excluded by default.
  • Loading branch information
bcoe committed Nov 13, 2016
1 parent 31488f5 commit 2828538
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down Expand Up @@ -157,4 +157,4 @@
"find-up"
]
}
}
}
6 changes: 3 additions & 3 deletions test/src/nyc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 2828538

Please sign in to comment.