Skip to content

pre-commit hook hangs in React TypeScript project | Using official husky installation guide #1153

Answered by baciladan
baciladan asked this question in Q&A
Discussion options

You must be logged in to vote

I am such a dummy, by default the test method in react apps created using create-react-app ( at least in the latest version ) is configured to run in watch mode and therefore is not exiting with an exit code.

Understandable now why the hook waited for the test script to exit before continuing the commit.

The fix was adding a new .env variable CI=true npm test that way the npm test command is ready to be used in CI purposes.
You can also setup a new npm script to run the tests in watch mode by using the --watchAll flag.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by baciladan
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
1 participant