question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress tests breaks husky and pre-commit: TypeError: dest.end is not a function

See original GitHub issue

I have tests written in cypress. Calling npm test works perfectly. But then I defined a pre-commit hook with husky and it runs the tests but breaks in the end with TypeError: dest.end is not a function.

At first I thought this was a problem with husky, not cypress, especially because running npm test directly works perfectly. So I opened an issue on husky about it, one month ago. But apparently this problem also occurs with a different git hooking library (namely pre-commit) as well.

This made me think that the problem might actually be in cypress, so I decided to open this issue. One of my guesses is that since cypress does a lot of magic, including calling other executables, maybe it somehow messed up the “completion” of the script in a way that works for direct npm test but doesn’t work when another library is trying to do something with the script output, error code or something like that.

Please take a look at the linked issue on husky for the full details, including the fully reproducible steps.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ryan-snydercommented, Apr 23, 2019

So this comment seems to have a potential solution for this problem. Not sure what the next steps are to solve this though or where the problem lies exactly. @bahmutov any thoughts?

1reaction
ryan-snydercommented, Apr 2, 2019

This issue could be related as well https://github.com/cypress-io/cypress/issues/2181 I was looking into running cypress in a pre-commit hook as well but we decided to run it on a gitlab merge request so Im not dealing with it anymore. Using git bash on windows with pre-commit causes this error but running cypress through git bash normally works which is odd

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: dest.end is not a function - node.js - Stack Overflow
It seems node-http2 has not been supported by Express yet. Please track this issue Support for module http on github.
Read more >
Automated End-to-End Testing with Cypress and Husky Pre ...
Sometimes, the automated waiting that Cypress offers might not be enough for the components to load. Maybe you have a backend request which ......
Read more >
rouch/Cypress: Fast, easy and reliable testing for anything that runs ...
Run the code and use it as the end user would. · Double check the issue and PR description to ensure it is...
Read more >
axe-core | Yarn - Package Manager
It integrates with your existing functional/acceptance automated tests. It automatically determines which rules to run based on the evaluation context. Axe ...
Read more >
Build script returned non-zero exit code: 2 2:46:20 PM ...
Tests Passing Failing 1 of 1 failed (100%) 00:22 17 14 2 ## print exit code on Mac or Linux $ echo $?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found