Skip to content

Commit

Permalink
Rename osxfswatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Apr 13, 2019
1 parent 078bc2d commit 793639f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ const fs_rmdir = promisify(fs.rmdir);
const fs_unlink = promisify(fs.unlink);

const isTravisMac = process.env.TRAVIS && os === 'darwin';
const FIXTURES_PATH = sysPath.join(__dirname, 'test-fixtures');
const FIXTURES_PATH_REL = 'test-fixtures';
const FIXTURES_PATH = sysPath.join(__dirname, FIXTURES_PATH_REL);
const allWatchers = [];
const PERM_ARR = 0o755; // rwe, r+e, r+e
let subdirId = 0;
let options;
let currentDir;
let osXFsWatch;
let macosFswatch;
let win32Polling;
let slowerDelay;

Expand Down Expand Up @@ -86,9 +86,9 @@ const runTests = function(baseopts) {

before(() => {
// flags for bypassing special-case test failures on CI
osXFsWatch = os === 'darwin' && !baseopts.usePolling && !baseopts.useFsEvents;
macosFswatch = os === 'darwin' && !baseopts.usePolling && !baseopts.useFsEvents;
win32Polling = os === 'win32' && baseopts.usePolling;
slowerDelay = osXFsWatch ? 100 : undefined;
slowerDelay = macosFswatch ? 100 : undefined;
});

beforeEach(function clean() {
Expand Down Expand Up @@ -393,7 +393,7 @@ const runTests = function(baseopts) {
addSpy.should.have.been.calledWith(newPath);
expect(addSpy.args[0][1]).to.be.ok; // stats
rawSpy.should.have.been.called;
if (!osXFsWatch) unlinkSpy.should.have.been.calledOnce;
if (!macosFswatch) unlinkSpy.should.have.been.calledOnce;
});
it('should emit `add`, not `change`, when previously deleted file is re-added', async () => {
const unlinkSpy = sinon.spy(function unlink(){});
Expand Down Expand Up @@ -797,7 +797,7 @@ const runTests = function(baseopts) {
spy.should.have.been.calledWith('change', changePath);
spy.should.not.have.been.calledWith('add', unlinkPath);
spy.should.not.have.been.calledWith('addDir');
if (!osXFsWatch) spy.should.have.been.calledThrice;
if (!macosFswatch) spy.should.have.been.calledThrice;
});
it('should correctly handle conflicting glob patterns', async () => {
const changePath = getFixturePath('change.txt');
Expand Down Expand Up @@ -1306,7 +1306,7 @@ const runTests = function(baseopts) {
spy.should.have.been.calledWith('add', getFixturePath('change.txt'));
spy.should.have.been.calledWith('add', getFixturePath('unlink.txt'));
spy.should.not.have.been.calledWith('change');
if (!osXFsWatch) spy.callCount.should.equal(4);
if (!macosFswatch) spy.callCount.should.equal(4);
});
it('should recurse to specified depth', async () => {
options.depth = 1;
Expand All @@ -1324,7 +1324,7 @@ const runTests = function(baseopts) {
spy.should.have.been.calledWith('change', addPath);
spy.should.not.have.been.calledWith('add', ignoredPath);
spy.should.not.have.been.calledWith('change', ignoredPath);
if (!osXFsWatch) spy.callCount.should.equal(8);
if (!macosFswatch) spy.callCount.should.equal(8);
});
it('should respect depth setting when following symlinks', async () => {
if (os === 'win32') return true; // skip on windows
Expand Down Expand Up @@ -1813,7 +1813,7 @@ const runTests = function(baseopts) {
await delay(300);
spy.should.have.been.calledWith('change', getFixturePath('change.txt'));
spy.should.not.have.been.calledWith('add');
if (!osXFsWatch) spy.should.have.been.calledOnce;
if (!macosFswatch) spy.should.have.been.calledOnce;
});
it('should ignore unwatched paths that are a subset of watched paths', async () => {
let watcher = chokidar_watch(currentDir, options);
Expand All @@ -1834,7 +1834,7 @@ const runTests = function(baseopts) {
spy.should.have.been.calledWith('change', getFixturePath('change.txt'));
spy.should.not.have.been.calledWith('add', getFixturePath('subdir/add.txt'));
spy.should.not.have.been.calledWith('unlink');
if (!osXFsWatch) spy.should.have.been.calledOnce;
if (!macosFswatch) spy.should.have.been.calledOnce;
});
it('should unwatch relative paths', async () => {
const fixturesDir = sysPath.relative(process.cwd(), currentDir);
Expand All @@ -1853,7 +1853,7 @@ const runTests = function(baseopts) {
await delay(300);
spy.should.have.been.calledWith('change', changeFile);
spy.should.not.have.been.calledWith('add');
if (!osXFsWatch) spy.should.have.been.calledOnce;
if (!macosFswatch) spy.should.have.been.calledOnce;
});
it('should watch paths that were unwatched and added again', async () => {
const spy = sinon.spy();
Expand All @@ -1871,7 +1871,7 @@ const runTests = function(baseopts) {
await write(getFixturePath('change.txt'), Date.now());
await waitFor([spy]);
spy.should.have.been.calledWith('change', getFixturePath('change.txt'));
if (!osXFsWatch) spy.should.have.been.calledOnce;
if (!macosFswatch) spy.should.have.been.calledOnce;
});
it('should unwatch paths that are relative to options.cwd', async () => {
options.cwd = currentDir;
Expand All @@ -1889,7 +1889,7 @@ const runTests = function(baseopts) {
spy.should.have.been.calledWith('change', 'change.txt');
spy.should.not.have.been.calledWith('add');
spy.should.not.have.been.calledWith('unlink');
if (!osXFsWatch) spy.should.have.been.calledOnce;
if (!macosFswatch) spy.should.have.been.calledOnce;
});
});
describe('close', () => {
Expand Down

0 comments on commit 793639f

Please sign in to comment.