JS Guide
Home
Questions
Topics
Companies
Resources
Bookmarks
Search
Toggle theme
Open menu
Home
Questions
Search
Progress
Home
Topics
testing
testing
Unit testing, integration testing, and E2E testing strategies
15
All
5
beginner
5
intermediate
5
advanced
0 of 15 topics read
0%
15 Topics
Testing Asynchronous Code
beginner
10 min
How to reliably test async operations including promises, async/await, timers, and error rejections using Jest and Vitest patterns that prevent false positives and flaky tests.
Unit Testing Fundamentals
beginner
8 min
Why testing matters, what unit tests are, what to test versus what to skip, and how automated tests improve code quality, enable safe refactoring, and serve as living documentation.
Code Coverage Metrics
intermediate
12 min
Understanding the four types of code coverage (line, branch, statement, function), interpreting coverage reports, setting meaningful targets, and knowing why 100% coverage does not guarantee bug-free code.
End-to-End Testing
advanced
15 min
End-to-end testing verifies complete user flows through a real browser, comparing Cypress and Playwright on architecture, cross-browser support, debugging, and performance to choose the right tool for your project.
Testing Custom React Hooks
intermediate
12 min
How to test custom React hooks using renderHook, handling state updates with act(), testing hook return values, and avoiding common pitfalls when hooks depend on context or async operations.
Integration Tests vs Unit Tests
intermediate
12 min
The difference between unit tests and integration tests, when to use each, the testing pyramid versus testing trophy, and how integration tests provide the best return on investment for most applications.
Matchers and Assertions
beginner
10 min
The essential Jest and Vitest matchers (toBe, toEqual, toMatch, toContain, toThrow) and how to choose the right assertion for each scenario to write clear, expressive test expectations.
TDD vs BDD Methodologies
advanced
15 min
Test-Driven Development (Red-Green-Refactor cycle) versus Behavior-Driven Development (Given-When-Then specifications), when each methodology shines, and how to apply them in practice for JavaScript projects.
Mocking Functions, Modules, and APIs
intermediate
15 min
How to use jest.fn(), jest.mock(), and jest.spyOn() (or their Vitest equivalents) to isolate code under test, plus API mocking with MSW for realistic network request testing.
Performance Testing and Budgets
advanced
15 min
How to test application performance with benchmarks, Web Vitals monitoring, Lighthouse CI integration, and performance budgets that prevent regressions in bundle size and runtime metrics.
React Testing Library
intermediate
15 min
Testing React components the way users interact with them using React Testing Library's query priority hierarchy, userEvent for realistic interactions, and the philosophy of testing behavior over implementation details.
Test Lifecycle Hooks
beginner
8 min
Using beforeAll, beforeEach, afterEach, and afterAll hooks for test setup and teardown, understanding execution order, scope with describe blocks, and preventing test pollution.
Testing Strategy for Large Applications
advanced
18 min
Designing a comprehensive testing strategy using the testing trophy, defining what to test at each level, setting coverage targets, integrating tests into CI/CD, and making pragmatic trade-offs for large-scale applications.
Test Organization and Structure
beginner
8 min
How to organize test files, structure tests with describe and it blocks, write descriptive test names, apply the Arrange-Act-Assert pattern, and choose between co-located and centralized test directories.
Visual Regression Testing
advanced
15 min
Catching unintended UI changes with visual regression testing using screenshot comparison tools like Percy, Chromatic, and Playwright, including how pixel diffing works and when visual tests add value.