Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(haste-map): watchman crawler now includes dotfiles #10075

Merged
merged 8 commits into from Jul 30, 2020

Conversation

@grosto
Copy link
Contributor

grosto commented May 23, 2020

Summary

Fixes #10063.
Fixes #9829.
Closes #9887.

Watchman will now crawl dotfiles. This now matches the behaviour of Node crawler.

Test plan

I added test to verify that watchman gets dotfiles and that behaviour is same as node crawler.

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch 2 times, most recently from 4ac6954 to 56755b6 May 24, 2020
@jeysal
jeysal approved these changes May 24, 2020
Copy link
Collaborator

jeysal left a comment

Awesome!

@jeysal jeysal requested review from SimenB and thymikee May 24, 2020
@thymikee
Copy link
Collaborator

thymikee commented May 24, 2020

I thought we want to go the other way around and stop crawling dotfiles (or .git) for Node watcher: #9829 (comment)

@jeysal
Copy link
Collaborator

jeysal commented May 24, 2020

Hmm, interesting. But .*rc.js files are quite common, also things like .storybook/*, maybe ignoring dotfiles is not the solution, but rather something like ignoring gitignored dotfiles, VCS directories, ...

@SimenB
Copy link
Collaborator

SimenB commented May 25, 2020

Ideally we'd crawl dotfiles, but make sure to ignore vcs directories. Stopping to crawl dotfiles for node was to match watchman, not the ideal solution (at least in my mind).

Respecting .gitignore etc is a different discussion imo

@grosto
Copy link
Contributor Author

grosto commented Jun 6, 2020

I agree with crawling the dotfiles and ignoring VCS directories by default. I don't think there is a need for an option to enable crawling of VCS directories.

I can update the PR if that sounds good

@jeysal
Copy link
Collaborator

jeysal commented Jun 6, 2020

SGTM :)

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch from 56755b6 to 7af063f Jun 11, 2020
Copy link
Contributor

lencioni left a comment

Thanks for working on this!

packages/jest-haste-map/src/index.ts Outdated Show resolved Hide resolved
@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch from 7af063f to f9083aa Jun 12, 2020
@grosto
Copy link
Contributor Author

grosto commented Jun 12, 2020

Updated PR

@cpojer
cpojer approved these changes Jun 23, 2020
Copy link
Contributor

cpojer left a comment

👍

@@ -113,6 +113,9 @@ const CHANGE_INTERVAL = 30;
const MAX_WAIT_TIME = 240000;
const NODE_MODULES = path.sep + 'node_modules' + path.sep;
const PACKAGE_JSON = path.sep + 'package.json';
const VCS_DIRECTORIES = ['.git', '.svn', '.hg']
.map(vcs => '/' + vcs + '/')

This comment has been minimized.

@cpojer

cpojer Jun 23, 2020 Contributor

This should use ^ and $, right?

This comment has been minimized.

@SimenB

SimenB Jun 23, 2020 Collaborator

should probably use path.sep like above as well?

This comment has been minimized.

@grosto

grosto Jul 14, 2020 Author Contributor

Good catch, changed to path.sep.

I don't think I understand why would this need ^ and $? it matches with all the strings that include path.sep + '.git' + path.sep and would not match with path.sep +'.github' + path.sep.

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch 2 times, most recently from 4340280 to 5582a2d Jul 14, 2020
@grosto
Copy link
Contributor Author

grosto commented Jul 14, 2020

Updated PR.

also missed it last time but the watcher was ignoring the dotfiles too. Now it should emit events on dotfiles too.

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch from 5582a2d to ec92955 Jul 14, 2020
@majames
Copy link

majames commented Jul 22, 2020

Looks great! Thanks for doing this! 🙌

SimenB added 2 commits Jul 23, 2020
@SimenB
SimenB approved these changes Jul 23, 2020
Copy link
Collaborator

SimenB left a comment

Thanks!

@@ -113,6 +114,9 @@ const CHANGE_INTERVAL = 30;
const MAX_WAIT_TIME = 240000;
const NODE_MODULES = path.sep + 'node_modules' + path.sep;
const PACKAGE_JSON = path.sep + 'package.json';
const VCS_DIRECTORIES = ['.git', '.hg']

This comment has been minimized.

@SimenB

SimenB Jul 23, 2020 Collaborator

svn?

This comment has been minimized.

@SimenB

SimenB Jul 23, 2020 Collaborator

meh, I have no idea how it works, and people can open a PR if needed. Should be a simple fix for anyone knowing how subversion works. And we only ship mercurial and git support anyways

@SimenB
Copy link
Collaborator

SimenB commented Jul 23, 2020

@grosto seems the new tests are failing on Travis - mind taking a look?

@grosto
Copy link
Contributor Author

grosto commented Jul 27, 2020

@SimenB looking into it

@SimenB
Copy link
Collaborator

SimenB commented Jul 28, 2020

@grosto any idea why that trailing slash only matters on Travis and not the 3 other CIs? I'd suspect one env is with watchman and the others are not or some such - is there some inconsistency?

EDIT: Ah, it still failed - never mind then 😅 I still suspect some watchman/no watchman mismatch, but I might be wrong

@grosto
Copy link
Contributor Author

grosto commented Jul 28, 2020

@SimenB I could not replicate the issue but I noticed this mismatch with other testIgnorePaths so made a blind shot. I will try to run it without watchman

@SimenB
Copy link
Collaborator

SimenB commented Jul 29, 2020

I don't trust travis, so let's try a fresh push. nodejs/docker-node#1298 (comment). While that's for the config and not code, who knows.

EDIT: Didn't help 😢 No idea what's going on, I'm unable to reproduce it

@grosto
Copy link
Contributor Author

grosto commented Jul 29, 2020

Yeah I am trying to reproduce it too, but cannot. I was thinking to rollback some changes to see if passes. It was passing(I think) before I pushed path.sep changes.

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch 2 times, most recently from e1db615 to a817726 Jul 29, 2020
@grosto
Copy link
Contributor Author

grosto commented Jul 29, 2020

I reverted the changes and even removed /__tests__/test_dotfiles_root/ and still failed with same error 🤷‍♂️ I guess it's some cache which makes this file

@SimenB
Copy link
Collaborator

SimenB commented Jul 29, 2020

I deleted the cache:
image

Let's see if re-running makes a difference

@grosto grosto force-pushed the grosto:fix_dotfiles_missing_from_hastemap branch 2 times, most recently from 9c98d53 to 4253ef9 Jul 29, 2020
@SimenB
Copy link
Collaborator

SimenB commented Jul 29, 2020

Travis says it's building this: 7449c30. Which is not HEAD of this PR...

@SimenB
Copy link
Collaborator

SimenB commented Jul 30, 2020

Meh, screw it. If it fails on master I'll delete the integration - we already build on CircleCI, GH Actions and Azure Pipelines regardless, should be covered

@SimenB SimenB changed the title Watchman crawler now includes dotfiles feat(haste-map): watchman crawler now includes dotfiles Jul 30, 2020
@SimenB SimenB merged commit e270997 into facebook:master Jul 30, 2020
21 of 23 checks passed
21 of 23 checks passed
cleanup-runs
Details
Running TypeScript compiler & ESLint
Details
Node v10.x on ubuntu-latest
Details
Node v10.x on macOS-latest
Details
Node v10.x on windows-latest
Details
Node v12.x on ubuntu-latest
Details
Node v12.x on macOS-latest
Details
Node v12.x on windows-latest
Details
Node v13.x on ubuntu-latest
Details
Node v13.x on macOS-latest
Details
Node v13.x on windows-latest
Details
Node v14.x on ubuntu-latest
Details
Node v14.x on macOS-latest
Details
Node v14.x on windows-latest
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
facebook.jest in progress
Details
Facebook CLA Check Contributor License Agreement is valid!
Details
ci/circleci: test-jest-circus Your tests passed on CircleCI!
Details
ci/circleci: test-node-10 Your tests passed on CircleCI!
Details
ci/circleci: test-node-12 Your tests passed on CircleCI!
Details
ci/circleci: test-node-13 Your tests passed on CircleCI!
Details
ci/circleci: test-node-14 Your tests passed on CircleCI!
Details
ci/circleci: test-or-deploy-website Your tests passed on CircleCI!
Details
@SimenB
Copy link
Collaborator

SimenB commented Jul 30, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.