Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove fsevents #130

Merged
merged 2 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
machine:
node:
version: 6.9.5
npm:
version: 3.10.10
dependencies:
pre:
- git clone https://github.com/facebook/watchman.git && cd watchman && git checkout v4.7.0 && ./autogen.sh && ./configure && make && sudo make install
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