-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Documenting running tests in precommit hook #2587
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
Comments
any plan to use https://github.com/okonet/lint-staged? you can then implement what I suggested in "scripts": {
"precommit": "lint-staged",
"test:staged": "cross-env CI=true react-scripts test --env=jsdom --findRelatedTests"
} then "lint-staged": {
"src/**/*.js": [
"test:staged",
"git add"
]
} for the env variable, use cross-env.. it is cross platform hope it helps! |
@luftywiranda13 thanks for that it works like a charm. i read that issue but must have glazed over ur solution, my bad! should this be documented? seems like something that people would want to use as their apps getting bigger. |
Yes, would be great to document this. |
@bowsplinter @gaearon ok, i'll make a PR 😊 |
I may be doing something wrong, but I'm finding that my precommit hook fails (rejects the commit) when there are no tests found via the |
@dan-weaver jest v22.1.0 exits without an error when no tests are found changelog or you can pass |
Just saw that thanks.. Sorry for the additional noise here :) |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. |
I want a git pre-commit hook that runs test on staged files before commits (similar to this)
This will require access to jest configs such as bail and findRelatedTests.
currently i am running this pre-commit
but this results in every single test being run, which takes a long time. i want to effectively run
I believe allowing for this will encourage better practices and am willing to take a stab at it if the maintainers think that it would be useful.
(also open to other solutions that people might use to achieve the same functionality)
The text was updated successfully, but these errors were encountered: