test: ensure ignore relative paths

(when asked)
This commit is contained in:
Remy Sharp
2019-10-07 12:07:53 +01:00
parent eead311749
commit d5b98915eb
4 changed files with 1097 additions and 726 deletions

View File

@@ -58,6 +58,11 @@ function watch() {
persistent: true,
usePolling: config.options.legacyWatch || false,
interval: config.options.pollingInterval,
// note to future developer: I've gone back and forth on adding `cwd`
// to the props and in some cases it fixes bugs but typically it causes
// bugs elsewhere (since nodemon is used is so many ways). the final
// decision is to *not* use it at all and work around it
// cwd: ...
};
if (utils.isWindows) {
@@ -85,7 +90,7 @@ function watch() {
watchedFiles.push(file);
bus.emit('watching', file);
debug('watching dir: %s', file);
debug('chokidar watching: %s', file);
});
watcher.on('ready', function () {
watchedFiles = Array.from(new Set(watchedFiles)); // ensure no dupes

1786
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -49,19 +49,19 @@
"husky": "^0.14.3",
"istanbul": "^0.4.5",
"jscs": "^3.0.7",
"mocha": "^2.3.3",
"mocha": "^2.5.3",
"proxyquire": "^1.8.0",
"semantic-release": "^8.2.0",
"semantic-release": "^8.2.3",
"should": "~4.0.0"
},
"dependencies": {
"chokidar": "^2.1.5",
"debug": "^3.1.0",
"chokidar": "^2.1.8",
"debug": "^3.2.6",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"pstree.remy": "^1.1.6",
"semver": "^5.5.0",
"supports-color": "^5.2.0",
"pstree.remy": "^1.1.7",
"semver": "^5.7.1",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.2",
"update-notifier": "^2.5.0"

View File

@@ -571,4 +571,20 @@ describe('watcher', function() {
assert(matched.result.length === 1, 'found match ' + matched.results);
});
it('should ignore relative directories', () => {
const monitor = match.rulesToMonitor([], [
"node_modules/*",
"**/logs/*"
])
var matched = match(
['logs/a'],
monitor,
'js,mjs,json'
);
assert(matched.ignored === 1 && matched.result.length === 0, JSON.stringify(matched));
})
});