-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Testrunner freezes / stops when setting up Express server #44189
Comments
@matthiashermsen the test will never end since the server keeps the event loop waiting for requests.
there is an effort to add better output that will stream the results as they pass (instead of waiting for the entire file to run), see #43344 anyhow, adding |
@MoLow thanks a lot for your reply. I tried that but that didn't help ( I used this code https://github.com/matthiashermsen/reproduce-broken-test-js/blob/main/test/HttpTests.js#L9 )
But I was wrong, the correct code should be import assert from 'assert/strict';
import express from 'express';
import test from 'node:test';
test('Http', async () => {
const app = express();
const server = app.listen(3000);
server.close();
assert.ok(false);
}); Now the runner doesn't freeze anymore :) |
Version
18.7.0
Platform
Linux pop-os 5.18.10-76051810-generic #202207071639
165910843122.04~c9172fb SMP PREEMPT_DYNAMIC Fri J x86_64 x86_64 x86_64 GNU/LinuxSubsystem
node:test
What steps will reproduce the bug?
mkdir reproduction && cd reproduction && npm init -y && npm install express
./test/HttpTests.js
containingpackage.json
withnpm run test
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
The testrunner should finish and exit with 1 since the assertion failed.
What do you see instead?
The testrunner freezes
Additional information
The test script is not using the default execution model because my project is using TypeScript and based on #43675 I had to find a way to use ts-node while using the builtin testrunner.
I created two reproduction repositories
The text was updated successfully, but these errors were encountered: