(fn)
| 5 | // TODO: Move to ReactInternalTestUtils |
| 6 | |
| 7 | function captureAssertion(fn) { |
| 8 | // Trick to use a Jest matcher inside another Jest matcher. `fn` contains an |
| 9 | // assertion; if it throws, we capture the error and return it, so the stack |
| 10 | // trace presented to the user points to the original assertion in the |
| 11 | // test file. |
| 12 | try { |
| 13 | fn(); |
| 14 | } catch (error) { |
| 15 | return { |
| 16 | pass: false, |
| 17 | message: () => error.message, |
| 18 | }; |
| 19 | } |
| 20 | return {pass: true}; |
| 21 | } |
| 22 | |
| 23 | function assertYieldsWereCleared(Scheduler, caller) { |
| 24 | const actualYields = Scheduler.unstable_clearLog(); |
no test coverage detected