Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Attempt to add a test for #272 #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions test/test-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,32 @@ describe('api', function () {
afterEach(function (done) {
w.on('end', function () {
rimraf.sync(fixtures('new.js'));
rimraf.sync(fixtures('.bin'));
done();
});
w.close();
});

describe('Basic functionality', function () {
it('should not report unexpected files when using relative globs', function (done) {
fs.mkdirSync(fixtures('.bin'));

w = watch('./**/*.js', function (file) {
done(new Error('Watched unexpected filepath: ' + file.path));
}).on('ready', touch(fixtures('.bin/index'), 'fixtures bin index'));
setTimeout(done, 600);
});

it('should not report unexpected files when using relative globs #2', function (done) {
fs.mkdirSync(fixtures('.bin'));
touch(fixtures('.bin/index'), 'fixtures bin index')();

w = watch('./**/*.js', function (file) {
done(new Error('Watched unexpected filepath: ' + file.path));
});
setTimeout(done, 600);
});

it('should normalize reported paths for modified files with non-normalized absolute glob', function (done) {
w = watch(fixtures('../fixtures/*.js'), function (file) {
file.path.should.eql(fixtures('index.js'));
Expand Down