Skip to content

Commit

Permalink
Fixes things
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Nison committed Oct 2, 2018
1 parent 60f37bf commit b512ae4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ describe('watchman watch', () => {
n.endsWith('.zip')
? [path.join(n, 'foo.1.js'), path.join(n, 'foo.2.js')]
: null,
rootDir: ROOT_MOCK,
roots: ROOTS,
}).then(data => {
expect(data.files).toEqual({
Expand Down
12 changes: 6 additions & 6 deletions packages/jest-haste-map/src/crawlers/watchman.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ module.exports = async function watchmanCrawl(
const existingFileData = data.files.get(relativeFilePath);
let nextData;

const isOld = existingFileData && existingFileData[H.MTIME] === mtime;
const hasChanged =
existingFileData && sha1hex && existingFileData[H.SHA1] === sha1hex;

if (existingFileData && isOld) {
if (existingFileData && existingFileData[H.MTIME] === mtime) {
nextData = existingFileData;
} else if (existingFileData && !hasChanged) {
} else if (
existingFileData &&
sha1hex &&
existingFileData[H.SHA1] === sha1hex
) {
nextData = [...existingFileData];
nextData[1] = mtime;
} else {
Expand Down

0 comments on commit b512ae4

Please sign in to comment.