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

Why don't you use git pre-push hooks? #554

Open
zikaari opened this issue Jul 14, 2018 · 4 comments
Open

Why don't you use git pre-push hooks? #554

zikaari opened this issue Jul 14, 2018 · 4 comments

Comments

@zikaari
Copy link

zikaari commented Jul 14, 2018

For people who send you PR's without running npm test and realizing that after Travis CI fails.

Don't you think pre-push git hook that runs npm test for them will prevent accidental bad pushes?

@DenisCarriere
Copy link

DenisCarriere commented Aug 21, 2018

👍 that wouldn't be a bad idea.

However then it wouldn't look as "clean" & simplistic as =>

  "scripts": {
    "test": "xo && ava"
  },

@zikaari
Copy link
Author

zikaari commented Aug 21, 2018

That's the premise actually. New contributors (even myself) sometimes forget to run npm test as said in the OP.

Too bad npm doesn't have prePush hook.

Enforcing this is as simple as:

echo 'exec npm test' > .git/hooks/pre-push

@Neaox
Copy link

Neaox commented Oct 2, 2018

Husky can help with this. (https://www.npmjs.com/package/husky)

@zikaari
Copy link
Author

zikaari commented Oct 2, 2018

That's a good one. Thanks for pointing that out!

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

No branches or pull requests

3 participants