Skip to content

Bug: using MessageChannel prevents node.js process from exiting #20756

@just-boris

Description


Edited: Here's how to fix this: #20756 (comment).


React version: 17.0.1 (latest)

Steps To Reproduce

This code finishes properly in node.js 14, but holds the process open in node.js 15

global.window = global; // simulate JSDOM
require('scheduler');

Since node.js 15, there is a global MessageChannel object now, which prevents node event loop from exiting. To let the process shut down properly, it should either call port.close() or port.unref()

This becomes an issue when testing React code within JSDOM environment, as the test process cannot exit properly.

The current behavior

The process with JSDOM tests never finishes

The expected behavior

The process finishes properly

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions