2

I am exiting with code 0 in my pre-push hook, but the push never happens. Any idea why my hooks ends successfully but the push does not happen?

here is my husky.config.js:

module.exports = {
  hooks: {
    'post-checkout': 'post-checkout',
    'pre-commit': 'lint-staged',
    'commit-msg': 'commit-msg && commitlint -E HUSKY_GIT_PARAMS',
    'pre-push':
      'yarn && yarn lint && yarn build && yarn test && echo $? && exit 0'
  }
};

troubleshoot

Git: git version 2.24.2 (Apple Git-127)

OS: macOS Catalina 10.15.3

Terminal: VSCode 1.44.2

Command:

HUSKY_DEBUG=1 yarn add husky --save-dev -W

Output:

[4/4]   Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ husky@4.2.5
info All dependencies
└─ husky@4.2.5
$ patch-package
patch-package 6.2.0
Applying patches...
No patch files found
✨  Done in 27.15s.

Command:

HUSKY_DEBUG=1 git push

Output:

...
Test Suites: 8 passed, 8 total
Tests:       113 passed, 113 total
Snapshots:   7 passed, 7 total
Time:        16.087s
Ran all test suites in 8 projects.
0
husky:debug yarn run --silent husky-run exited with 0 exit code
Community
  • 1
  • 1
Ken Bigler
  • 587
  • 1
  • 4
  • 15
  • 3
    Did you ever solved this? – Paulo Fabrício Sep 30 '20 at 21:45
  • Sorry to ask, but did you verify if the changes are staged and committed? – Julio Feferman Feb 22 '21 at 15:49
  • It's been a while, but I think we just upgraded the version of husky to fix this, sorry I didn't answer it right when it was resolved. Julio of course they were staged and committed, none of this would have even run if it wasn't. – Ken Bigler Jul 28 '22 at 18:50
  • For anyone coming across this – ran into this problem and the issue was that our tests were taking too long and Github was closing the connection before everything had finished. – Charlie Stanard Aug 11 '22 at 22:13

0 Answers0