mirror of https://github.com/status-im/metro.git
Use a mock for FileWatcher
Reviewed By: davidaurelio Differential Revision: D2628885 fb-gh-sync-id: f8b96c483eb7deb52a7ca4897801e2d0ef9e4f4c
This commit is contained in:
parent
8ff93e65d2
commit
de981ecccd
|
@ -13,7 +13,6 @@ jest
|
||||||
.dontMock('../fastfs')
|
.dontMock('../fastfs')
|
||||||
.dontMock('../replacePatterns')
|
.dontMock('../replacePatterns')
|
||||||
.dontMock('../DependencyGraph/docblock')
|
.dontMock('../DependencyGraph/docblock')
|
||||||
.dontMock('../../FileWatcher')
|
|
||||||
.dontMock('../Module');
|
.dontMock('../Module');
|
||||||
|
|
||||||
jest
|
jest
|
||||||
|
@ -24,10 +23,12 @@ var Module = require('../Module');
|
||||||
var ModuleCache = require('../ModuleCache');
|
var ModuleCache = require('../ModuleCache');
|
||||||
var Promise = require('promise');
|
var Promise = require('promise');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var FileWatcher = require('../../FileWatcher');
|
|
||||||
|
|
||||||
describe('Module', () => {
|
describe('Module', () => {
|
||||||
const fileWatcher = new FileWatcher(['/root']);
|
const fileWatcher = {
|
||||||
|
on: () => this,
|
||||||
|
isWatchman: () => Promise.resolve(false),
|
||||||
|
};
|
||||||
|
|
||||||
describe('Async Dependencies', () => {
|
describe('Async Dependencies', () => {
|
||||||
function expectAsyncDependenciesToEqual(expected) {
|
function expectAsyncDependenciesToEqual(expected) {
|
||||||
|
|
|
@ -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';
|
'use strict';
|
||||||
|
|
||||||
const Promise = require('promise');
|
const Promise = require('promise');
|
||||||
|
|
|
@ -81,7 +81,7 @@ fs.stat.mockImpl(function(filepath, callback) {
|
||||||
var mtime = {
|
var mtime = {
|
||||||
getTime: function() {
|
getTime: function() {
|
||||||
return Math.ceil(Math.random() * 10000000);
|
return Math.ceil(Math.random() * 10000000);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (node.SYMLINK) {
|
if (node.SYMLINK) {
|
||||||
|
|
Loading…
Reference in New Issue