0
0
Gitdevops~10 mins

Sharing hooks with the team (husky) in Git - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to install Husky in your project.

Git
npm install [1] --save-dev
Drag options to blanks, or click blank then click option'
Ahusky
Beslint
Cwebpack
Dbabel
Attempts:
3 left
💡 Hint
Common Mistakes
Installing the wrong package like eslint or webpack.
Forgetting to add --save-dev to save as a development dependency.
2fill in blank
medium

Complete the command to initialize Husky in your project.

Git
npx husky [1]
Drag options to blanks, or click blank then click option'
Asetup
Binit
Cstart
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'init' or 'start' instead of 'install'.
Not running this command after installing Husky.
3fill in blank
hard

Fix the error in the command to add a pre-commit hook that runs tests.

Git
npx husky add .husky/pre-commit "[1]"
Drag options to blanks, or click blank then click option'
Anpm test
Bnpm start
Cnode server.js
Dgit commit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm start' which runs the app instead of tests.
Trying to run 'git commit' inside the hook.
4fill in blank
hard

Fill both blanks to add a pre-push hook that runs lint and format checks.

Git
npx husky add .husky/pre-push "[1] && [2]"
Drag options to blanks, or click blank then click option'
Anpm run lint
Bnpm run test
Cnpm run format
Dnpm start
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm run test' instead of lint or format.
Using 'npm start' which runs the app.
5fill in blank
hard

Fill all three blanks to add a prepare script in package.json that installs Husky and sets up Git hooks.

Git
"prepare": "npm [1] husky && npx husky [2] && npx husky [3]"
Drag options to blanks, or click blank then click option'
Ainstall
Cadd .husky/pre-commit 'npm test'
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'init' instead of 'install' for setting up Husky.
Forgetting to add the pre-commit hook command.