How to use the jest-react.unstable_toMatchRenderedOutput function in jest-react

To help you get started, we’ve selected a few jest-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / react / scripts / jest / matchers / reactTestMatchers.js View on Github external
function toMatchRenderedOutput(ReactNoop, expectedJSX) {
  if (typeof ReactNoop.getChildrenAsJSX === 'function') {
    const Scheduler = ReactNoop._Scheduler;
    assertYieldsWereCleared(Scheduler);
    return captureAssertion(() => {
      expect(ReactNoop.getChildrenAsJSX()).toEqual(expectedJSX);
    });
  }
  return JestReact.unstable_toMatchRenderedOutput(ReactNoop, expectedJSX);
}

jest-react

Jest matchers and utilities for testing React components.

MIT
Latest version published 17 days ago

Package Health Score

93 / 100
Full package analysis

Popular jest-react functions