bcoe / bcoe/c8

Docs question: how should I specify multiple exclusions on the commandline?

Open
#256 0 comments 11 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Suppose I'm calling c8 on the commandline:
```
npx c8 --all --exclude npm run test
```
and I want to exclude multiple folders (e.g. `upgrade`, `test`). Based on the documentation
```
--exclude, -x a list of specific files and directories that
should be excluded from coverage (glob
patterns are supported)
[default: ["coverage/**","packages/*/test{,s}/**","**/*.d.ts","test{,s}/**","t
est{,-*}.{js,cjs,mjs,ts}","**/*{.,-}test.{js,cjs,mjs,ts}","**/__tests__/**","*
*/{ava,nyc}.config.{js,cjs,mjs}","**/jest.config.{js,cjs,mjs,ts}","**/{karma,r
ollup,webpack}.config.js","**/{babel.config,.eslintrc,.mocharc}.{js,cjs}"]]
```
I thought I had to pass this in as a Javascript array
```
npx c8 --all --exclude '["upgrade/**","test/**"]' npm run test
```
but this doesn't work. What works is passing multiple `exclude` flags:
```
npx c8 --all --exclude "upgrade/**" --exclude "test/**" npm run test
```
and it looks like I can also exclude folders by just passing the folder directly:
```
npx c8 --all --exclude "upgrade" --exclude "test" npm run test
```
----
Is the multiple flags method the intended way of passing exclusions, or is there a way to do it with only one flag?

Is the folder exclusion possibility intended and safe to write, or does it just work by accident? I thought it might be unintended because the default exclusion list includes constructs like `"coverage/**"` and `"test{,s}/**"` and it seems they could be simplified down to `"coverage"` and `"test{,s}"` if directory exclusion was supposed to work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.