diff --git a/package.json b/package.json index c66a864..d18e9a6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "gulpplugin" ], "scripts": { - "test": "mocha -R spec -t 5000", + "test": "mocha -R spec", "coverage": "istanbul cover node_modules/.bin/_mocha --report html -- -R spec", "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" }, diff --git a/test/callback.js b/test/callback.js index c5cc515..be26e87 100644 --- a/test/callback.js +++ b/test/callback.js @@ -2,6 +2,8 @@ var watch = require('..'); var join = require('path').join; +var fs = require('fs'); +var rimraf = require('rimraf'); var touch = require('./touch.js'); require('should'); @@ -13,6 +15,7 @@ describe('callback', function () { var w; afterEach(function (done) { + rimraf.sync(fixtures('newDir')); w.on('end', done); w.close(); }); @@ -37,4 +40,16 @@ describe('callback', function () { } }); }); + + it('should be called on add event in new directory', function (done) { + rimraf.sync(fixtures('newDir')); + + w = watch(fixtures('**/*.ts'), function (file) { + file.relative.should.eql('newDir/index.ts'); + done(); + }).on('ready', function () { + fs.mkdirSync(fixtures('newDir')); + touch(fixtures('newDir/index.ts'))(); + }); + }); });