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

Improve source pattern handling #614

Closed
novemberborn opened this issue Mar 7, 2016 · 4 comments · Fixed by #730
Closed

Improve source pattern handling #614

novemberborn opened this issue Mar 7, 2016 · 4 comments · Fixed by #730
Assignees

Comments

@novemberborn
Copy link
Member

Watch mode lets you configure which source files should be watched. Certain directories are ignored by default, using https://github.com/novemberborn/ignore-by-default. Currently if you use a negation pattern in --source it stops ignoring those default directories. This is annoying as you'll have to repeat them manually.

It would be good to stop one of those default directories from being ignored. Then we could let you specify a negation pattern without disabling all default ignore patterns.

You can find the current logic at https://github.com/sindresorhus/ava/blob/1868204c1901f45b4f66a520ef6486fdd71fe1d2/lib/watcher.js#L273:L276.

@novemberborn
Copy link
Member Author

Perhaps !!node_modules/**/* can be used to disable the !node_modules/**/* pattern. Then we change the aforementioned logic to include the remaining patterns.

@sindresorhus
Copy link
Member

@novemberborn I don't think we should invent our own glob patterns.

Currently if you use a negation pattern in --source it stops ignoring those default directories.

Why?

I'm failing to see the problem here. Maybe provide an example?

@novemberborn
Copy link
Member Author

Hmm. The problem may be different actually. We should be able to merge the ignore patterns. However it should be possible to override a pattern.

For example you might want to treat a dependency as a source so you can more easily debug that dependency and it's impact on your own project. I'll need to verify whether adding node_modules/somedependency/**/*.js works or whether !node_modules/**/* overrides it. Will update the issue.

@novemberborn novemberborn self-assigned this Apr 5, 2016
novemberborn added a commit that referenced this issue Apr 6, 2016
Fixes #614. Allow negated source patterns to be specified without unsetting the
default negation patterns.

Allow source patterns to override the default negation patterns if they start
with one of the ignored directories.
@novemberborn novemberborn changed the title Source negation patterns disable default ignore patterns Improve source pattern handling Apr 7, 2016
@novemberborn
Copy link
Member Author

#730 ensures that:

  • You can specify negated patterns without having to declare the default exclusion patterns
  • You can override the default exclusion patterns. E.g. specifying node_modules/some_dir/**/* will select that directory as a source, while the default exclusion pattern node_modules/**/* remains in effect

novemberborn added a commit that referenced this issue Apr 12, 2016
Fixes #614. Allow negated source patterns to be specified without unsetting the
default negation patterns.

Allow source patterns to override the default negation patterns if they start
with one of the ignored directories.
jamestalmage pushed a commit that referenced this issue Apr 12, 2016
* watcher: correctly test if source is in the cwd

Make sure the path starts with ../ (after platform-specific slashes have been
corrected). Clarify existing test and add a case where the source starts with
two dots but is still in the current working directory.

* change handling of negated source patterns

Fixes #614. Allow negated source patterns to be specified without unsetting the
default negation patterns.

Allow source patterns to override the default negation patterns if they start
with one of the ignored directories.

* update watch mode docs

* Suggest `watch:test` as the npm script
* Document how to always enable watch mode using the ava section in package.json
* Recommend source patterns are configured through the ava section in package.json
* Suggest using the verbose reporter when debugging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants