Home / Function/ expectTestToFail() — react Function Reference

expectTestToFail() — react Function Reference

Architecture documentation for the expectTestToFail() function in setupTests.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2392ccee_84a6_6928_1fd0_6889e595e724["expectTestToFail()"]
  7a8b988c_a832_ec08_c36e_22d30113be12["setupTests.js"]
  2392ccee_84a6_6928_1fd0_6889e595e724 -->|defined in| 7a8b988c_a832_ec08_c36e_22d30113be12
  23bece51_b879_d1c9_8c4d_6e5c1d112231["global()"]
  23bece51_b879_d1c9_8c4d_6e5c1d112231 -->|calls| 2392ccee_84a6_6928_1fd0_6889e595e724
  style 2392ccee_84a6_6928_1fd0_6889e595e724 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/__tests__/setupTests.js lines 37–57

const expectTestToFail = async (callback, error) => {
  if (callback.length > 0) {
    throw Error(
      'Gated test helpers do not support the `done` callback. Return a ' +
        'promise instead.',
    );
  }
  try {
    const maybePromise = callback();
    if (
      maybePromise !== undefined &&
      maybePromise !== null &&
      typeof maybePromise.then === 'function'
    ) {
      await maybePromise;
    }
  } catch (testError) {
    return;
  }
  throw error;
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does expectTestToFail() do?
expectTestToFail() is a function in the react codebase, defined in packages/react-devtools-shared/src/__tests__/setupTests.js.
Where is expectTestToFail() defined?
expectTestToFail() is defined in packages/react-devtools-shared/src/__tests__/setupTests.js at line 37.
What calls expectTestToFail()?
expectTestToFail() is called by 1 function(s): global.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free