Socket
Socket
Sign inDemoInstall

jest-snapshot

Package Overview
Dependencies
21
Maintainers
6
Versions
277
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-snapshot


Version published
Weekly downloads
24M
decreased by-2.71%
Maintainers
6
Install size
17.5 MB
Created
Weekly downloads
ย 

Package description

What is jest-snapshot?

The jest-snapshot package is a part of the Jest testing framework. It allows developers to capture snapshots of values, typically React component trees, and compare them to previously recorded snapshots to detect changes. This is useful for ensuring that UI does not change unexpectedly.

What are jest-snapshot's main functionalities?

Snapshot Testing

This feature allows you to create a snapshot of a value, which will be saved to a file. On subsequent test runs, the saved snapshot is compared to the current value, and any differences will cause the test to fail. This is useful for testing the output of components.

expect(value).toMatchSnapshot();

Inline Snapshots

Inline snapshots work similarly to regular snapshots, but instead of saving the snapshot to a separate file, it is embedded directly in the test file. This can be more convenient for smaller snapshots or when you want to keep the test and its expected output closely tied together.

expect(value).toMatchInlineSnapshot();

Snapshot Property Matchers

Snapshot property matchers allow you to ignore certain properties within a snapshot by using matchers from Jest's expect API. This is useful when you want to ignore dynamic values that change between test runs, such as timestamps or generated IDs.

expect(value).toMatchSnapshot({ createdAt: expect.any(Date) });

Other packages similar to jest-snapshot

Changelog

Source

29.6.0

Features

  • [jest-circus, jest-snapshot] Add support for snapshot matchers in concurrent tests (#14139)
  • [jest-cli] Include type definitions to generated config files (#14078)
  • [jest-snapshot] Support arrays as property matchers (#14025)
  • [jest-core, jest-circus, jest-reporter, jest-runner] Added support for reporting about start individual test cases using jest-circus (#14174)

Fixes

  • [jest-circus] Prevent false test failures caused by promise rejections handled asynchronously (#14110)
  • [jest-config] Handle frozen config object (#14054)
  • [jest-config] Allow coverageDirectory and collectCoverageFrom in project config (#14180)
  • [jest-core] Always use workers in watch mode to avoid crashes (#14059).
  • [jest-environment-jsdom, jest-environment-node] Fix assignment of customExportConditions via testEnvironmentOptions when custom env subclass defines a default value (#13989)
  • [jest-matcher-utils] Fix copying value of inherited getters (#14007)
  • [jest-mock] Tweak typings to allow jest.replaceProperty() replace methods (#14008)
  • [jest-mock] Improve user input validation and error messages of spyOn and replaceProperty methods (#14087)
  • [jest-runtime] Bind jest.isolateModulesAsync to this (#14083)
  • [jest-runtime] Forward wrapperLength to the Script constructor as columnOffset for accurate debugging (#14148)
  • [jest-runtime] Guard _isMockFunction access with in (#14188)
  • [jest-snapshot] Fix a potential bug when not using prettier and improve performance (#14036)
  • [@jest/transform] Do not instrument .json modules (#14048)
  • [jest-worker] Restart a shut down worker before sending it a task (#14015)

Chore & Maintenance

  • [*] Update semver dependency to get vulnerability fix (#14262)
  • [docs] Updated documentation for the --runTestsByPath CLI command (#14004)
  • [docs] Updated documentation regarding the synchronous fallback when asynchronous code transforms are unavailable (#14056)
  • [docs] Update jest statistics of use and downloads in website Index.

FAQs

Last updated on 04 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc