diff --git a/lib/monitor/match.js b/lib/monitor/match.js index 16a43cf..1001c7e 100644 --- a/lib/monitor/match.js +++ b/lib/monitor/match.js @@ -27,6 +27,7 @@ function match(files, monitor, ext) { }); var good = [], + whitelist = [], // files that we won't check against the extension ignored = 0, watched = 0; @@ -43,7 +44,17 @@ function match(files, monitor, ext) { if (minimatch(file, rules[i])) { watched++; utils.log.detail('matched rule: ' + rules[i]); - good.push(file); + + // if the rule doesn't match the WATCH EVERYTHING + // but *does* match a rule that ends with *.*, then + // white list it - in that we don't run it through + // the extension check too. + if (rules[i] !== '**/*.*' && rules[i].slice(-3) === '*.*') { + console.log(file, rules[i]); + whitelist.push(file); + } else { + good.push(file); + } matched = true; break; } @@ -69,7 +80,7 @@ function match(files, monitor, ext) { } // else assume *.* return { - result: good, + result: good.concat(whitelist), ignored: ignored, watched: watched, total: files.length diff --git a/test/monitor/match.test.js b/test/monitor/match.test.js index 69d11c8..9731ccd 100644 --- a/test/monitor/match.test.js +++ b/test/monitor/match.test.js @@ -40,7 +40,7 @@ describe('match', function () { var result = match(files, ['*.*'], 'js'); - assert.deepEqual(result.result, [], 'no results returned'); + assert.deepEqual(result.result, [], 'no results returned: ' + result.result); }); it('should match .coffee if watching *.js & *.coffee', function (done) {