-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when editing file inside watched directory
Also better align behavior with `gulp.watch`. Reference: #206 (comment)
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* global describe, it, afterEach */ | ||
|
||
var watch = require('..'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var rimraf = require('rimraf'); | ||
var touch = require('./touch.js'); | ||
require('should'); | ||
|
||
function fixtures(glob) { | ||
return path.join(__dirname, 'fixtures', glob); | ||
} | ||
|
||
describe('dir', function () { | ||
var w; | ||
|
||
afterEach(function (done) { | ||
rimraf.sync(fixtures('newDir')); | ||
w.on('end', done); | ||
w.close(); | ||
}); | ||
|
||
it('should not watch files inside directory', function (done) { | ||
fs.mkdirSync(fixtures('newDir')); | ||
touch(fixtures('newDir/index.js'))(); | ||
w = watch(fixtures('newDir'), function () { | ||
done('Watched unexpected file.'); | ||
}).on('ready', function () { | ||
touch(fixtures('newDir/index.js'))('new content'); | ||
setTimeout(done, 200); | ||
}); | ||
}); | ||
|
||
it('should watch directory creation'); | ||
|
||
it('should watch directory removal'); | ||
}); |