-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
docs(test): add instruction on how to integrate test in pre-commit hook #2598
Conversation
@@ -52,13 +52,13 @@ You can find the most recent version of this guide [here](https://github.com/fac | |||
- [Filename Conventions](#filename-conventions) | |||
- [Command Line Interface](#command-line-interface) | |||
- [Version Control Integration](#version-control-integration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's instead move both Integration sections after Coverage Reporting.
|
||
The build command will check for linter warnings and fail if any are found. | ||
|
||
### Pre-commit Hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should either be ####
or become a new entry in table of contents.
@gaearon ok, ready to be reviewed |
@@ -1084,13 +1085,38 @@ The watcher includes an interactive command-line interface with the ability to r | |||
|
|||
![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif) | |||
|
|||
### Version Control Integration | |||
### Pre-commit Hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this right after Continuous Integration
section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this?
hmmm and I'm a bit confused of ### On CI Servers
& ### On Your Own Environment
. where are they belong to? also they're not in TOC
@@ -1327,6 +1294,39 @@ The test command will force Jest to run tests once instead of launching the watc | |||
|
|||
The build command will check for linter warnings and fail if any are found. | |||
|
|||
### Pre-commit Hook | |||
|
|||
You can run tests against "staged" files before each Git commit by integrating the test script in pre-commit hook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just merged a very similar PR for Prettier commit hook. Should we unify those sections? We can leave non-hook descriptions in both and link to a section where both hooks are described with a common setup step. Can be called "Useful Hooks".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed to add docs about prettier in CRA? since there's no special step to do it in a CRA based project.
people can read through prettier
docs then do exactly what the docs say, it'll just work. and IMO by merging #2006 will make CRA docs bloated day by day.
on the other hand, i think we should add docs & explain something which are specific/special in CRA based project like how to run test, storybook, coverage reporting, linting, etc. yeah basically just like what we did so far in our docs except for #2006.
what do you think? but if you think that it doesnt matter, i'll go on and do what you suggested here 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already added docs about Prettier (#2006 is merged). I'm referring to consolidating those two sections and removing duplication between them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, any suggestion on where to put the "Useful Hooks"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put it somewhere you like, I'll take a look and think about it
This will make integration `prettier` easier for CRA users
@gaearon any suggestions? |
This pull request 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. |
This pull request has been automatically closed because it has not had any recent activity. The conversation will be locked in 7 days unless the pull request is reopened. Thank you for your contribution. |
Since Jest added a flag called
--findRelatedTests
,some users asked about how to do this in CRA.
I've helped to answer them but I think it's a good time to document this now in
Running Tests
section. So then we can guide them to the docs.close #2587 #2336