API reference
Jest API reference
Jest unit testing
- Identifiers
- 104
- With full guides
- 0
- Types
- 4
Topics covered
- Matchers
- Mocks & spies
- Module mocks
- Async tests
- Setup / teardown
- Snapshot testing
- Coverage
- Fake timers
Function
| Name | What it does |
|---|
describe | Function |
test | Function |
expect | Function |
beforeEach | Function |
afterEach | Function |
jest.fn | Function |
jest.mock | Function |
jest.spyOn | Function |
toEqual | Function |
toHaveBeenCalled | Function |
beforeAll | Function |
afterAll | Function |
jest.useFakeTimers | Function |
jest.clearAllMocks | Function |
jest.resetModules | Function |
expect.extend | Function |
toMatchSnapshot | Function |
toThrow | Function |
mockResolvedValue | Function |
it | Function |
test.each | Function |
describe.each | Function |
it.only | Function |
it.skip | Function |
it.todo | Function |
test.concurrent | Function |
xdescribe | Function |
xit | Function |
fit | Function |
Type Alias
| Name | What it does |
|---|
jest.Mock | Type Alias |
jest.Mocked | Type Alias |
jest.SpyInstance | Type Alias |
MockedFunction | Type Alias |
Module
| Name | What it does |
|---|
toBe | Module |
toStrictEqual | Module |
toBeNull | Module |
toBeUndefined | Module |
toBeDefined | Module |
toBeTruthy | Module |
toBeFalsy | Module |
toBeGreaterThan | Module |
toBeGreaterThanOrEqual | Module |
toBeLessThan | Module |
toBeLessThanOrEqual | Module |
toBeCloseTo | Module |
toMatch | Module |
toMatchObject | Module |
toContain | Module |
toContainEqual | Module |
toHaveLength | Module |
toHaveProperty | Module |
toBeInstanceOf | Module |
toBeNaN | Module |
toMatchInlineSnapshot | Module |
toHaveBeenCalledTimes | Module |
toHaveBeenCalledWith | Module |
toHaveBeenLastCalledWith | Module |
toHaveBeenNthCalledWith | Module |
toHaveReturned | Module |
toHaveReturnedWith | Module |
resolves | Module |
rejects | Module |
not | Module |
any | Module |
anything | Module |
arrayContaining | Module |
objectContaining | Module |
stringContaining | Module |
stringMatching | Module |
assertions | Module |
hasAssertions | Module |
jest.resetAllMocks | Module |
jest.restoreAllMocks | Module |
jest.useRealTimers | Module |
jest.advanceTimersByTime | Module |
jest.runAllTimers | Module |
jest.runOnlyPendingTimers | Module |
jest.mocked | Module |
jest.requireActual | Module |
jest.requireMock | Module |
jest.doMock | Module |
jest.unmock | Module |
jest.setTimeout | Module |
jest.isolateModules | Module |
mockReturnValue | Module |
mockRejectedValue | Module |
mockImplementation | Module |
mockImplementationOnce | Module |
mockReturnValueOnce | Module |
mockReset | Module |
mockClear | Module |
mockRestore | Module |
mockName | Module |
Pipe
| Name | What it does |
|---|
testEnvironment | Pipe |
setupFiles | Pipe |
setupFilesAfterEach | Pipe |
moduleNameMapper | Pipe |
transform | Pipe |
collectCoverage | Pipe |
coverageThreshold | Pipe |
testMatch | Pipe |
preset | Pipe |
projects | Pipe |
globalSetup | Pipe |
Search across every package and filter by type in your dashboard.
Start learning