Skip to content

Commit

Permalink
Prevents watchers from being awake by created folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Nison committed Aug 9, 2018
1 parent c0819fc commit f4e36e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/jest-haste-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import {version as VERSION} from '../package.json';
import {getSha1, worker} from './worker';
import crypto from 'crypto';
import EventEmitter from 'events';
import fs from 'fs';
import getMockName from './get_mock_name';
import getPlatformExtension from './lib/get_platform_extension';
import H from './constants';
import HasteFS from './haste_fs';
import HasteModuleMap from './module_map';
import invariant from 'invariant';
// eslint-disable-next-line import/default
import nodeCrawl from './crawlers/node';
import normalizePathSep from './lib/normalize_path_sep';
Expand Down Expand Up @@ -719,10 +721,11 @@ class HasteMap extends EventEmitter {
type: string,
filePath: Path,
root: Path,
stat: {mtime: Date},
stat: ?fs.Stats,
) => {
filePath = path.join(root, normalizePathSep(filePath));
if (
(stat && stat.isDirectory()) ||
this._ignore(filePath) ||
!extensions.some(extension => filePath.endsWith(extension))
) {
Expand Down Expand Up @@ -792,6 +795,7 @@ class HasteMap extends EventEmitter {
// If the file was added or changed,
// parse it and update the haste map.
if (type === 'add' || type === 'change') {
invariant(stat, 'since the file exists or changed, it should have stats');
const fileMetadata = ['', stat.mtime.getTime(), 0, [], null];
hasteMap.files[filePath] = fileMetadata;
const promise = this._processFile(
Expand Down

0 comments on commit f4e36e2

Please sign in to comment.