diff --git a/test/index.js b/test/index.js index b232673..32cdfcf 100644 --- a/test/index.js +++ b/test/index.js @@ -22,8 +22,8 @@ describe('glob-watcher', function() { var outFile1 = path.join(outDir, 'changed.js'); var outFile2 = path.join(outDir, 'added.js'); var globPattern = '**/*.js'; - var outGlob = normalizePath(path.join(outDir, globPattern)); - var singleAdd = normalizePath(path.join(outDir, 'changed.js')); + var outGlob = path.join(outDir, globPattern); + var singleAdd = path.join(outDir, 'changed.js'); var ignoreGlob = '!' + singleAdd; function changeFile() { @@ -313,6 +313,18 @@ describe('glob-watcher', function() { watcher.on('ready', changeFile); }); + it('can re-add a glob after it has been negated (unix style path)', function(done) { + watcher = watch([outGlob, ignoreGlob, normalizePath(singleAdd)]); + + watcher.once('change', function(filepath) { + expect(filepath).toEqual(singleAdd); + done(); + }); + + // We default `ignoreInitial` to true, so always wait for `on('ready')` + watcher.on('ready', changeFile); + }); + it('does not mutate the globs array', function(done) { var globs = [outGlob, ignoreGlob, singleAdd]; watcher = watch(globs);