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

Update gate pragma to detect global error events #28591

Merged
merged 1 commit into from
Mar 20, 2024

Commits on Mar 19, 2024

  1. Update gate pragma to detect global error events

    If a global error event is dispatched during a test, Jest reports that
    test as a failure.
    
    Our `@gate` pragma feature should account for this — if the gate
    condition is false, and the global error event is dispatched, then the
    test should be reported as a success.
    
    The solution is to install an error event handler right before invoking
    the test function. Because we install our own handler, Jest will not
    report the test as a failure if a global error event is dispatched;
    it's conceptually as if we wrapped the whole test event in a try-catch.
    acdlite committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    ad6b1c1 View commit details
    Browse the repository at this point in the history