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 6fd8527
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,16 @@ describe('watchman watch', () => {

return watchmanCrawl({
data: {
clocks: Object.create(null),
files: Object.create(null),
clocks: new Map(),
files: new Map(),
},
extensions: ['js', 'json', 'zip'],
ignore: pearMatcher,
mapper: n =>
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 6fd8527

Please sign in to comment.