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

fix(watcher): honor 'watched: false' in patterns. #620

Conversation

joakimkarlsson
Copy link

Includes the patterns for files to include, but not to watch, in
addition to the excludes list when creating a list of patterns
to ignore. This makes the watcher ignore patterns marked as
"watched: false" in karma's configuration file.

Closes: #616

Includes the patterns for files to include, but not to watch, in
addition to the excludes list when creating a list of patterns
to ignore. This makes the watcher ignore patterns marked as
"watched: false" in karma's configuration file.

Closes: karma-runner#616
@dignifiedquire
Copy link
Member

Thanks @joakimkarlsson !
Looks good to me 👍

@@ -45,20 +46,25 @@ var watchPatterns = function(patterns, watcher) {
// Function to test if an item is on the exclude list
// and therefore should not be watched by chokidar
// TODO(vojta): ignore non-matched files as well
var createIgnore = function(excludes) {
var createIgnore = function(excludes, patterns) {
var ex = _(patterns)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need lodash ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see, the map('pattern'), ignore my previous comment

@vojtajina
Copy link
Contributor

@joakimkarlsson thanks, this is a very nice PR !

I think we should change the algorithm to:

check all patterns (that are watched true), if none matching -> IGNORE
if there is a matching pattern, go through exclude patterns, if some matching -> IGNORE

I believe your current solution would fail this test:

files = [
  {pattern: 'src/one.js', watched: true},
  {pattern: 'src/*.js', watched: false}
];

This should watch src/one.js, but it won't.

There is a problem with my suggestion though - we need to NOT ignore directories, so we need implement this first paulmillr/chokidar#51

@ghost ghost assigned vojtajina Oct 18, 2013
@vojtajina
Copy link
Contributor

@joakimkarlsson I finally looked into it and I hope it's fixed in 6a272aa

I changed chokidar to check "ignored" after having the stat and changed the watching/ignoring algorithm as described above.

This should significantly improve performance.

I'm closing this PR. Thanks for bringing this up @joakimkarlsson !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"watched: false" not being honored in config file.
3 participants