dillon1000/react

Commit

Update gate pragma to detect global error events (#28591)

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.
Browse files
Changed paths2 files
First-parent comparison
M scripts/babel/__tests__/transform-test-gate-pragma-test.js ModifiedM scripts/jest/setupTests.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…