Skip to content

Commit

Permalink
remove fsevents
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Sep 26, 2018
1 parent dedc549 commit 56ebd34
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 132 deletions.
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const NodeWatcher = require('./src/node_watcher');
const PollWatcher = require('./src/poll_watcher');
const WatchmanWatcher = require('./src/watchman_watcher');
const WatchexecWatcher = require('./src/watchexec_watcher');
const FSEventsWatcher = require('./src/fsevents_watcher');

function throwNoFSEventsSupports() {
throw new Error('Sane >= 4 no longer support the fsevents module.');
}

function sane(dir, options) {
options = options || {};
Expand All @@ -18,7 +21,7 @@ function sane(dir, options) {
} else if (options.watchexec) {
return new WatchexecWatcher(dir, options);
} else if (options.fsevents) {
return new FSEventsWatcher(dir, options);
throwNoFSEventsSupports();
} else {
return new NodeWatcher(dir, options);
}
Expand All @@ -29,4 +32,9 @@ sane.NodeWatcher = NodeWatcher;
sane.PollWatcher = PollWatcher;
sane.WatchmanWatcher = WatchmanWatcher;
sane.WatchexecWatcher = WatchexecWatcher;
sane.FSEventsWatcher = FSEventsWatcher;

Object.defineProperty(sane, 'FSEventsWatcher', {
get() {
throwNoFSEventsSupports();
},
});
122 changes: 0 additions & 122 deletions src/fsevents_watcher.js

This file was deleted.

12 changes: 5 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var rimraf = require('rimraf');
var path = require('path');
var assert = require('assert');
var tmp = require('tmp');
var os = require('os');

tmp.setGracefulCleanup();
var jo = path.join.bind(path);
Expand All @@ -19,11 +18,12 @@ describe('sane in node mode', function() {
harness.call(this, {});
});

if (os.platform() === 'darwin') {
describe('sane in fsevents mode', function() {
harness.call(this, { fsevents: true });
describe('sane in fsevents mode', function() {
it('errors in a helpful manner', function() {
assert.throws(() => sane.FSEventsWatcher, 'asdf');
assert.throws(() => sane('/dev/null', { fsevents: true }), 'asdf');
});
}
});

describe('sane in watchman mode', function() {
harness.call(this, { watchman: true });
Expand All @@ -43,8 +43,6 @@ function getWatcherClass(mode) {
return sane.WatchexecWatcher;
} else if (mode.poll) {
return sane.PollWatcher;
} else if (mode.fsevents) {
return sane.FSEventsWatcher;
} else {
return sane.NodeWatcher;
}
Expand Down

0 comments on commit 56ebd34

Please sign in to comment.