jest-snapshot
Advanced tools
Changelog
jest 18.0.0
See https://jestjs.io/blog/2016/12/15/2016-in-jest
pit
and mockImpl
. Use it
or mockImplementation
instead.--bail
is used together with --watch
.pretty-format
is now merged into Jest.require('v8')
now works properly in a test context.expect.any
, expect.anything
, expect.objectContaining
, expect.arrayContaining
, expect.stringMatching
.snapshotSerializers
, setupFiles
, transform
, testRunner
and testResultsProcessor
instead of using path.resolve
.--testResultsProcessor
is now exposed through the cli.--jsonOutputFile
to --outputFile
.jest-editor-support
for vscode and Nuclide integration.test.concurrent
unhandled promise rejections.testRegex
to include test.js
and spec.js
files.babel-plugin-jest-hoist
when using jest.mock
with three arguments.JSON
global in jest-environment-node
now comes from the vm context instead of the parent context.FakeTimers.useTimers()
is called.JEST_HIDE_USAGE
.expect.assertions(number)
which will ensure that a specified amount of assertions is made in one test..toMatchSnapshot(?string)
feature to give snapshots a name.jest-react-native
was deprecated and now forwards react-native
..toMatchObject
matcher.NaN% Failed
in the OS notification when using --notify
..toHaveProperty
matcher.Map
/Set
comparisons.test.concurrent
now works with --testNamePattern
.Changelog
jest 17.0.3
.toHaveLength
matcher..toContain
matcher.Changelog
jest 17.0.1
.native.js
files in react-native projects.Changelog
jest 17.0.0
expect.extend
.--expand
(or -e
) to show the full diff.scriptPreprocessor
with the new transform
option.jest.resetAllMocks
which replaces jest.clearAllMocks
.jest-environment-node
..babelrc
is now part of the transform cache key in babel-jest
.jest-haste-map
.--json
now includes information about individual tests inside a file.Changelog
jest 16.0.2
jest-mock
.toHaveBeenCalledWith()
works without arguments again.Changelog
jest 16.0.0
jest <pattern>
is now case-insensitive.it.only
, it.skip
, test.only
, test.skip
and xtest
.--testNamePattern=pattern
or -t <pattern>
to run individual tests in test files.a
, o
, p
, q
or enter
while tests are running in the watch mode, the test run will be interrupted.--bail
now works together with --watch
.test.concurrent
for concurrent async tests..jsx
extension.jest.clearAllMocks
to clear all mocks manually.jest-snapshot
can now be more easily integrated into other test runners and used in other projects.fit
or when an error is thrown in a test.toHaveBeenLastCalledWith
, toHaveBeenCalledWith
, lastCalledWith
and toBeCalledWith
failure messages.toBeInstanceOf
matcher.toContainEqual
matcher.toThrowErrorMatchingSnapshot
matcher.moduleNameMapper
resolution.setupTestFrameworkScriptFile
script to make it easier to use chai together with Jest.--findRelatedTests <fileA> <fileB>
cli option to run tests related to the specified files.jest.deepUnmock
to babel-plugin-jest-hoist
.jest.runTimersToTime
which is useful together with fake timers.