Skip to content

Commit

Permalink
Add test on #56
Browse files Browse the repository at this point in the history
Closes #56
  • Loading branch information
floatdrop committed Jan 21, 2015
1 parent 67914be commit a68ce04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
15 changes: 15 additions & 0 deletions test/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -13,6 +15,7 @@ describe('callback', function () {
var w;

afterEach(function (done) {
rimraf.sync(fixtures('newDir'));
w.on('end', done);
w.close();
});
Expand All @@ -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'))();
});
});
});

0 comments on commit a68ce04

Please sign in to comment.