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

feat: adding husky to check for tests #124

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: adding husky to check for tests #124

wants to merge 5 commits into from

Conversation

jalvar53
Copy link
Collaborator

  • Adding husky to hook quality checks on pre-commit

NOTE: Husky can't be added to the generated code since it requires a .git folder (A Git repository created inside) to be able to hook to it.

@jalvar53 jalvar53 changed the title Feat/issue 24 feat: adding husky to check for tests May 27, 2022
Copy link
Collaborator Author

@jalvar53 jalvar53 left a comment

Choose a reason for hiding this comment

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

When running the tests they fail on the e2e flow due to the npm link command that links the parent dependencies from the .dist folder. When it does it fails to detect the .git folder inside and fails

@goldbergyoni
Copy link
Contributor

Then how do we fix this? Maybe activate only one flag --initialize-git --apply-git-hook?

cc @kalitas @rluvaton

@goldbergyoni
Copy link
Contributor

@all-contributors please add @adandanielteamint for content

@allcontributors
Copy link
Contributor

@goldbergyoni

I've put up a pull request to add @adandanielteamint! 🎉

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run build && npm test
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would run tests only on affected files using the --onlychanged flag to reduce the wait until the commit and leave the full tests run for the CI

@@ -18,7 +18,8 @@
"copy-templates": "rsync -av --exclude '*node_modules*' ./src/code-templates/ ./.dist/src/code-templates",
"build:watch": "tsc --watch",
"start:cli": "node ./.dist/bin/cli.js interactive",
"publish:build": "npm run build && npm publish ./.dist --access public"
"publish:build": "npm run build && npm publish ./.dist --access public",
"prepare": "husky install"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Then how do we fix this? Maybe activate only one flag --initialize-git --apply-git-hook?

@goldbergyoni @jalvar53 We can fix it but only running husky install if NODE_ENV is different than test

(Need to check if works well for Windows as well 😄)

Suggested change
"prepare": "husky install"
"prepare": "test \"$NODE_ENV\" == \"test\" || husky install"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants