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

docs(test): add instruction on how to integrate test in pre-commit hook #2598

Closed
wants to merge 16 commits into from

Conversation

luftywiranda13
Copy link
Contributor

@luftywiranda13 luftywiranda13 commented Jun 23, 2017

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

@@ -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)
Copy link
Contributor

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
Copy link
Contributor

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.

@luftywiranda13
Copy link
Contributor Author

@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
Copy link
Contributor

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?

Copy link
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Copy link
Contributor Author

@luftywiranda13 luftywiranda13 left a 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.
Copy link
Contributor

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".

Copy link
Contributor Author

@luftywiranda13 luftywiranda13 Jun 28, 2017

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 😊

Copy link
Contributor

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.

Copy link
Contributor Author

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"?

Copy link
Contributor

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

@luftywiranda13
Copy link
Contributor Author

@gaearon any suggestions?

@stale
Copy link

stale bot commented Nov 2, 2018

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.

@stale stale bot added the stale label Nov 2, 2018
@stale
Copy link

stale bot commented Nov 7, 2018

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.

@stale stale bot closed this Nov 7, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documenting running tests in precommit hook
3 participants