-
Hi, I installed husky in my create-react-app project that uses the typescript template. I have installed husky using the following commands:
This command also created a basic pre-commit hook that runs The npm test command runs after a commit but hangs after the following msg in the terminal:
My package.json file has the following scrips ( related to husky ):
To mention that husky automatically created the If I close the process in the terminal using CTRL+C ( I am using bash as my terminal ) I get the following error:
I am using the following versions: husky: "^8.0.1" Feel free to ask for any additional details. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 |
Beta Was this translation helpful? Give feedback.
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
variableCI=true npm test
that way thenpm 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.