Skip to content

Commit

Permalink
Use a mock for FileWatcher
Browse files Browse the repository at this point in the history
Reviewed By: davidaurelio

Differential Revision: D2628885

fb-gh-sync-id: f8b96c483eb7deb52a7ca4897801e2d0ef9e4f4c
  • Loading branch information
cpojer authored and facebook-github-bot-7 committed Nov 9, 2015
1 parent 8c59866 commit 44b051d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jest
.dontMock('../fastfs')
.dontMock('../replacePatterns')
.dontMock('../DependencyGraph/docblock')
.dontMock('../../FileWatcher')
.dontMock('../Module');

jest
Expand All @@ -24,10 +23,12 @@ var Module = require('../Module');
var ModuleCache = require('../ModuleCache');
var Promise = require('promise');
var fs = require('fs');
var FileWatcher = require('../../FileWatcher');

describe('Module', () => {
const fileWatcher = new FileWatcher(['/root']);
const fileWatcher = {
on: () => this,
isWatchman: () => Promise.resolve(false),
};

describe('Async Dependencies', () => {
function expectAsyncDependenciesToEqual(expected) {
Expand Down
8 changes: 8 additions & 0 deletions packager/react-packager/src/DependencyResolver/fastfs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';

const Promise = require('promise');
Expand Down
2 changes: 1 addition & 1 deletion packager/react-packager/src/__mocks__/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fs.stat.mockImpl(function(filepath, callback) {
var mtime = {
getTime: function() {
return Math.ceil(Math.random() * 10000000);
}
},
};

if (node.SYMLINK) {
Expand Down

0 comments on commit 44b051d

Please sign in to comment.