Quick note
Error: connect ECONNREFUSED when integration testing a Node.js app
In an express.js app that I was integration testing using Mocha the tests suddenly started acting weird with complaint such as:
"before all" hook: Error: connect ECONNREFUSED
Turned out the root cause was a test method that should have been asynchronous wasn't, it was declared as function() instead of function(done). Pretty obvious in hindsight but with an error message like that it took a while to locate.
Similar articles
- Why is the async keyword needed in JavaScript?
- Exception order when awaiting multiple async tasks in C#
- Quickly mapping an array of URLs to responses with JavaScript async/await and Promise.all
- Detecting mouse and keyboard input with .NET
- Learning Scala part eight – Scala’s type hierarchy and object equality
- Rhino Mocks - Use Arg<T> ONLY within a mock method call while recording
- Inversion of Control – It’s broader than just injecting components
- jQuery developers, where is the progressive enhancement?