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.

node does not exit when starting express server in uvu setup

See original GitHub issue

I’ve got a uvu setup that seems fine apart from hanging after displaying test results.

In test.before() I create two web servers, one using nodejs http module (is a simple git http server), and one for the app using express (and use test.after() to close them down). Even though I can see both servers do shut down, uvu hangs after printing the test summary (with all tests passing) and I have to Ctrl-C.

I’m using the express server so I can use webpack-dev-middleware to serve modules from memory without a full build. However, I can run without the express server when I’m doing a test on the build, because I don’t need the middleware for that.

So when I run a build test I don’t use the express server, but replace it with a nodejs server that serves the static build output. So in this case I have two nodejs http servers, one for the git http server and one for the app. This works fine and after passing all tests, uvu exits. So it seems to be to do with the express app or server.

I’m sure the server is closing, and have tried several modules that help close the running server if connections remain open. But inspecting the server object I can see there are no open connections, and the server does appear to have shut down correctly.

Do you have any experience of starting a server inside uvu tests, and particularly with express? I’m not sure it is a big enough issue to go into in depth (because I can just run an external server during development testing) but want to ask in case it’s an easy thing to solve. Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lukeedcommented, Feb 4, 2021

Cool! uvu is short, easy to remember, and easy to type. The acronym for “ultimate velocity unleashed” was shoe horned after haha

0reactions
happybeingcommented, Feb 4, 2021

Thank you so much, that works. And thanks for uvu (why ‘uvu’ by the way?).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make node.js not exit on error - Stack Overflow
Here an exception will be thrown, it will not be caught by the global error handler, and your node app will terminate.
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Run more than one...
Read more >
How can I use webpack with express ? · Issue #1206 - GitHub
Hello. When I try to use webpack with a simple express server I always get TONS of errors: express.js 'use strict'; var express...
Read more >
How to prevent your Node.js process from crashing - Medium
js process with a non-zero exit code. There are two important things here: The process doesn't crash. The process continues to work. But...
Read more >
Cant deploy my site to heroku. please help
I have coded a reactjs app with nodeJSExpress as backend. The backend and front-end has the same root folder. I run react on...
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