Loading tutorials
test, expect, describe). A working knowledge of HTML roles, labels, and form elements he3 min readtest, expect, and describe functions from Jest or Vitest. By the end you will have a project that can render a component and use jest-dom matchers.2 min readrender does and why queries go through screen.2 min readrender and screen, and that jest-dom matchers are already set up. It also assumes you know async/await.2 min readgetBy, queryBy, and findBy variants from the previous chapter.3 min readrender, query with screen, and know the difference between getBy, queryBy, and findBy. When a query fails, Testing Library gives you enough information to find the cause without guessing. You only need to know where to look.2 min readtest and expect in Jest or Vitest, and can run a basic Testing Library query such as screen.getByRole. It covers the matchers that @testing-library/jest-dom adds, and how to choose among them.2 min read@testing-library/jest-dom configured. It also assumes you know how to render a component and query it by role, as covered in earlier chapters.2 min readrender, screen, and role-based queries. It also assumes you know how user-event simulates clicks and typing, and that you know the jest-dom matchers. Here you will combine them to test a complete form, from typing to submission.3 min readgetBy and queryBy variants, and are comfortable with promises and async/await. Many components show a loading state first and the real content later. The test has to wait for that change without guessing how long it2 min readrender, screen, and user-event, and that you know Jest or Vitest syntax. Examples use jest. In Vitest, use vi in place of jest.2 min readrender and screen. It also assumes you know React context and providers.2 min readrender and screen work, and have Jest or Vitest configured with jsdom. Hooks cannot be called outside a React component, so testing one directly fails. renderHook solves this by running your hook inside a small test component and giving2 min readrender, screen, user-event, and jest-dom matchers, and that you know the difference between getBy, queryBy, and findBy. It collects the mistakes that most often make React Testing Library tests brittle or misleading, and shows the fix 3 min read