Watch lib/*.* ignores the extension check. Closes #255

This commit is contained in:
Remy Sharp
2014-01-06 15:34:43 +00:00
parent 9d138df520
commit 589dffcc42
2 changed files with 14 additions and 3 deletions

View File

@@ -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

View File

@@ -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) {