About 87 results
Open links in new tab
  1. Jest · Delightful JavaScript Testing

    Jest is a JavaScript testing framework designed to ensure correctness of any JavaScript codebase. It allows you to write tests with an approachable, familiar and feature-rich API that …

  2. Getting Started - Jest

    There are two ways to have Jest global APIs typed for test files written in TypeScript. You can use type definitions which ships with Jest and will update each time you update Jest.

  3. Testing Asynchronous Code · Jest

    It's common in JavaScript for code to run asynchronously. When you have code that runs asynchronously, Jest needs to know when the code it is testing has completed, before it can …

  4. Testing React Apps · Jest

    See React: Function and Class Components. Reminders that with Class components, we expect Jest to be used to test props and not methods directly. Now let's use React's test renderer and …

  5. Snapshot Testing · Jest

    If you'd like to limit which snapshot test cases get re-generated, you can pass an additional --testNamePattern flag to re-record snapshots only for those tests that match the pattern. You …

  6. Globals - Jest

    In your test files, Jest puts each of these methods and objects into the global environment. You don't have to require or import anything to use them. However, if you prefer explicit imports, …

  7. Mock Functions - Jest

    To test this function, we can use a mock function, and inspect the mock's state to ensure the callback is invoked as expected.

  8. Expect - Jest

    In this case, toBe is the matcher function. There are a lot of different matcher functions, documented below, to help you test different things. The argument to expect should be the …

  9. Mock Functions - Jest

    This is useful when you want to mock functions in certain test cases and restore the original implementation in others. The restoreMocks configuration option is available to restore mocks …

  10. Setup and Teardown - Jest

    Once the describe blocks are complete, by default Jest runs all the tests serially in the order they were encountered in the collection phase, waiting for each to finish and be tidied up before …