Skip to content

Commit

Permalink
ci-test
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Aug 6, 2022
1 parent 6df7d1d commit 6407876
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/index.js
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6407876

Please sign in to comment.