Jest
Configuring Jest
Config: automock
Config: bail
Config: browser
Config: cacheDirectory
Config: clearMocks
Config: collectCoverage
Config: collectCoverageFrom
Config: coverageDirectory
Config: coveragePathIgnorePatterns
Config: coverageReporters
Config: coverageThreshold
Config: globals
Config: mapCoverage
Config: moduleDirectories
Config: moduleFileExtensions
Config: moduleNameMapper
Config: modulePathIgnorePatterns
Config: modulePaths
Config: notify
Config: preset
Config: projects
Config: reporters
Config: resetMocks
Config: resetModules
Config: resolver
Config: rootDir
Config: roots
Config: setupFiles
Config: setupTestFrameworkScriptFile
Config: snapshotSerializers
Config: testEnvironment
Config: testMatch
Config: testPathIgnorePatterns
Config: testRegex
Config: testResultsProcessor
Config: testRunner
Config: testURL
Config: timers
Config: transform
Config: transformIgnorePatterns
Config: unmockedModulePathPatterns
Config: verbose
Configuring Jest
Expect
.not
.rejects
.resolves
.toBe()
.toBeCloseTo()
.toBeDefined()
.toBeFalsy()
.toBeGreaterThan()
.toBeGreaterThanOrEqual()
.toBeInstanceOf()
.toBeLessThan()
.toBeLessThanOrEqual()
.toBeNull()
.toBeTruthy()
.toBeUndefined()
.toContain()
.toContainEqual()
.toEqual()
.toHaveBeenCalled()
.toHaveBeenCalledTimes()
.toHaveBeenCalledWith()
.toHaveBeenLastCalledWith()
.toHaveLength()
.toHaveProperty()
.toMatch()
.toMatchObject()
.toMatchSnapshot()
.toThrow()
.toThrowErrorMatchingSnapshot()
Expect
expect.addSnapshotSerializer()
expect.any()
expect.anything()
expect.arrayContaining()
expect.assertions()
expect.extend()
expect.hasAssertions()
expect.objectContaining()
expect.stringContaining()
expect.stringMatching()
expect()
Globals
afterAll()
afterEach()
beforeAll()
beforeEach()
describe.only()
describe.skip()
describe()
Globals
require.requireActual()
require.requireMock()
test.only()
test.skip()
test()
Guides
An Async Example
Manual Mocks
Migrating to Jest
Snapshot Testing
Testing Other Frameworks
Testing React Apps
Testing React Native Apps
Timer Mocks
Troubleshooting
Using With Webpack
Guides: Introduction
Mock Functions
Mock Functions
mockFn.mock.calls
mockFn.mock.instances
mockFn.mockClear()
mockFn.mockImplementation()
mockFn.mockImplementationOnce()
mockFn.mockReset()
mockFn.mockRestore()
mockFn.mockReturnThis()
mockFn.mockReturnValue()
mockFn.mockReturnValueOnce()
More Resources
Setup and Teardown
Testing Asynchronous Code
Using Matchers
Index
index
Jest CLI Options
jest
jest --bail
jest --cache
jest --ci
jest --collectCoverageFrom
jest --colors
jest --config
jest --coverage
jest --debug
jest --env
jest --expand
jest --findRelatedTests
jest --forceExit
jest --help
jest --json
jest --lastCommit
jest --listTests
jest --logHeapUsage
jest --maxWorkers
jest --noStackTrace
jest --notify
jest --onlyChanged
jest --outputFile
jest --runInBand
jest --setupTestFrameworkScriptFile
jest --showConfig
jest --silent
jest --testNamePattern
jest --testPathPattern
jest --testRunner
jest --updateSnapshot
jest --useStderr
jest --verbose
jest --version
jest --watch
jest --watchAll
jest --watchman
Jest CLI Options
The Jest Object
jest.clearAllMocks()
jest.clearAllTimers()
jest.disableAutomock()
jest.enableAutomock()
jest.fn()
jest.genMockFromModule()
jest.isMockFunction()
jest.mock()
jest.resetAllMocks()
jest.resetModules()
jest.runAllTicks()
jest.runAllTimers()
jest.runOnlyPendingTimers()
jest.runTimersToTime()
jest.setMock()
jest.spyOn()
jest.unmock()
jest.useFakeTimers()
jest.useRealTimers()
The Jest Object
请登录查看
A
A
默认
夜间
Jest 官网文档
阅读(41.8k)
收藏
赞
(
0
)
分享
手册简介
Jest 官方参考文档
更新记录
多端阅读
在PC/MAC上查看《Jest》
下载《Jest》离线版客户端
,进入客户端后通过搜索当前教程手册的名称并下载,就可查看当前离线教程文档。
在移动端查看《Jest》
扫一扫或
直接访问
https://m.w3cschool.cn/doc_jest/
在手机APP上查看《Jest》
下载w3cschool手机App端
,请从各大安卓应用商店、苹果App Store搜索并下载w3cschool手机客户端,在App中搜索当前教程手册的名称查看。
扩展栏目
开发工具IDE
编程训练营
Wiki列表
意见反馈
X
意见反馈:
联系方式:
提交
查看完整版笔记
保存
关闭
违规举报
X
广告等垃圾信息
不友善内容
违反法律法规的内容
不宜公开讨论的政治内容
其他
提交