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

Add unstable APIs for async rendering to test renderer #12478

Merged
merged 1 commit into from
Mar 28, 2018

Commits on Mar 28, 2018

  1. Add unstable APIs for async rendering to test renderer

    These are based on the ReactNoop renderer, which we use to test React
    itself. This gives library authors (Relay, Apollo, Redux, et al.) a way
    to test their components for async compatibility.
    
    - Pass `unstable_isAsync` to `TestRenderer.create` to create an async
    renderer instance. This causes updates to be lazily flushed.
    - `renderer.unstable_yield` tells React to yield execution after the
    currently rendering component.
    - `renderer.unstable_flushAll` flushes all pending async work, and
    returns an array of yielded values.
    - `renderer.unstable_flushThrough` receives an array of expected values,
    begins rendering, and stops once those values have been yielded. It
    returns the array of values that are actually yielded. The user should
    assert that they are equal.
    
    Although we've used this pattern successfully in our own tests, I'm not
    sure if these are the final APIs we'll make public.
    acdlite committed Mar 28, 2018
    Configuration menu
    Copy the full SHA
    c4bab31 View commit details
    Browse the repository at this point in the history