feat: ignore files outside of the project root by default?feat:
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
* **Version**: v12.1.0
* **Platform**: Windows 7 64-bit
I have some JavaScript configuration files that are dynamically generated during tests. It seems that those generated JS files are also counted as part of the source code. These config files are generated inside a temporary directory created by [tmp](https://github.com/raszi/node-tmp), and they will be `require()`ed during the test.
[Here is a simple repro](https://github.com/eight04/node-test/tree/c8-dynamic-source), run `npm test` to see the error. It seems that this problem is Windows-only. At least, Travis doesn't show this error:
```
D:\Dev\node-test>npm test
> node-test@1.0.1 test D:\Dev\node-test
> c8 --reporter lcov node index
file: D:\Dev\node-test\config.js error: Error: ENOENT: no such file or directory
, open 'D:\Dev\node-test\config.js'
at Object.openSync (fs.js:454:3)
at readFileSync (fs.js:354:35)
at V8ToIstanbul.load (D:\Dev\node-test\node_modules\v8-to-istanbul\lib\v8-to
-istanbul.js:30:23)
at Report.getCoverageMapFromAllCoverageFiles (D:\Dev\node-test\node_modules\
c8\lib\report.js:65:25)
at Report.run (D:\Dev\node-test\node_modules\c8\lib\report.js:37:28)
at exports.outputReport (D:\Dev\node-test\node_modules\c8\lib\commands\repor
t.js:24:16)
at D:\Dev\node-test\node_modules\c8\bin\c8.js:31:13
at ChildProcess. (D:\Dev\node-test\node_modules\foreground-child\
index.js:52:5)
at ChildProcess.emit (events.js:196:13)
at ChildProcess.cp.emit (D:\Dev\node-test\node_modules\cross-spawn\lib\enoen
t.js:40:29)
```
So:
1. Is there a way to exclude a path/pattern from being processed by c8?
2. Can we ignore files *outside* of the project root by default?
Contributor guide
Assessment
This issue has not been assessed yet.