Skip to content

Testrunner freezes / stops when setting up Express server #44189

@matthiashermsen

Description

@matthiashermsen

Version

18.7.0

Platform

Linux pop-os 5.18.10-76051810-generic #202207071639165910843122.04~c9172fb SMP PREEMPT_DYNAMIC Fri J x86_64 x86_64 x86_64 GNU/Linux

Subsystem

node:test

What steps will reproduce the bug?

  • Create a new project via mkdir reproduction && cd reproduction && npm init -y && npm install express
  • Add ./test/HttpTests.js containing
import assert from 'assert/strict';
import express from 'express';
import test from 'node:test';

test('Http', async () => {
  const server = express();
    
  server.listen(3000);
  assert.ok(false);
});
  • Replace the content of the package.json with
{
  "name": "reproduction",
  "type": "module",
  "scripts": {
    "test": "node --test $(find . -name '*Tests.js')"
  }
}
  • Run the tests via npm 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

Metadata

Metadata

Assignees

Labels

test_runnerIssues and PRs related to the test runner subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions