Skip to content

Commit b512ae4

Browse files
author
Maël Nison
committed
Fixes things
1 parent 60f37bf commit b512ae4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/jest-haste-map/src/crawlers/__tests__/watchman.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ describe('watchman watch', () => {
201201
n.endsWith('.zip')
202202
? [path.join(n, 'foo.1.js'), path.join(n, 'foo.2.js')]
203203
: null,
204+
rootDir: ROOT_MOCK,
204205
roots: ROOTS,
205206
}).then(data => {
206207
expect(data.files).toEqual({

packages/jest-haste-map/src/crawlers/watchman.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,13 @@ module.exports = async function watchmanCrawl(
184184
const existingFileData = data.files.get(relativeFilePath);
185185
let nextData;
186186

187-
const isOld = existingFileData && existingFileData[H.MTIME] === mtime;
188-
const hasChanged =
189-
existingFileData && sha1hex && existingFileData[H.SHA1] === sha1hex;
190-
191-
if (existingFileData && isOld) {
187+
if (existingFileData && existingFileData[H.MTIME] === mtime) {
192188
nextData = existingFileData;
193-
} else if (existingFileData && !hasChanged) {
189+
} else if (
190+
existingFileData &&
191+
sha1hex &&
192+
existingFileData[H.SHA1] === sha1hex
193+
) {
194194
nextData = [...existingFileData];
195195
nextData[1] = mtime;
196196
} else {

0 commit comments

Comments
 (0)