Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --exclude-node-modules option #321

Merged
merged 2 commits into from Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/commands/report.js
Expand Up @@ -24,7 +24,8 @@ exports.outputReport = async function (argv) {
all: argv.all,
allowExternal: argv.allowExternal,
src: argv.src,
skipFull: argv.skipFull
skipFull: argv.skipFull,
excludeNodeModules: argv.excludeNodeModules
})
await report.run()
if (argv.checkCoverage) await checkCoverages(argv, report)
Expand Down
5 changes: 5 additions & 0 deletions lib/parse-args.js
Expand Up @@ -41,6 +41,11 @@ function buildYargs (withCommands = false) {
describe: 'supplying --src will override cwd as the default location where --all looks for src files. --src can be ' +
'supplied multiple times and each directory will be included. This allows for workspaces spanning multiple projects'
})
.option('exclude-node-modules', {
default: true,
type: 'boolean',
describe: 'whether or not to exclude all node_module folders (i.e. **/node_modules/**) by default'
})
.option('include', {
alias: 'n',
default: [],
Expand Down
6 changes: 4 additions & 2 deletions lib/report.js
Expand Up @@ -27,7 +27,8 @@ class Report {
all,
src,
allowExternal = false,
skipFull
skipFull,
excludeNodeModules
}) {
this.reporter = reporter
this.reportsDirectory = reportsDirectory
Expand All @@ -37,7 +38,8 @@ class Report {
this.exclude = new Exclude({
exclude: exclude,
include: include,
relativePath: !allowExternal
relativePath: !allowExternal,
excludeNodeModules: excludeNodeModules
})
this.excludeAfterRemap = excludeAfterRemap
this.omitRelative = omitRelative
Expand Down