Skip to content
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

Internal test helpers: Use Node's MessageChannel to queue task #26345

Merged

Commits on Mar 8, 2023

  1. Internal test helpers: Use Node's MessageChannel to queue task

    To wait for the microtask queue to empty, our internal test helpers
    schedule an arbitrary task using `setImmediate`. It doesn't matter
    what kind of task it is, only that it's a separate task from the
    current one, because by the time it fires, the microtasks for the
    current event will have already been processed.
    
    The issue with `setImmediate` is that Jest mocks it. Which can lead to
    weird behavior.
    
    I've changed it to instead use a message event, via the MessageChannel
    implementation exposed by the `node:worker_threads` module.
    
    We should consider doing this in the public implementation of
    `act`, too.
    acdlite committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    8be059f View commit details
    Browse the repository at this point in the history