Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/jest-image-snapshot

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/jest-image-snapshot

TypeScript definitions for jest-image-snapshot

  • 6.4.0
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/jest-image-snapshot?

@types/jest-image-snapshot provides TypeScript type definitions for the jest-image-snapshot package, which is used for image comparison in Jest tests. It allows developers to write tests that compare images to a baseline image and fail if the images do not match within a specified threshold.

What are @types/jest-image-snapshot's main functionalities?

Image Snapshot Testing

This feature allows you to compare an image to a baseline image and fail the test if the images do not match within a specified threshold. The `toMatchImageSnapshot` matcher is used to perform the comparison.

import { toMatchImageSnapshot } from 'jest-image-snapshot';

describe('Image Snapshot Testing', () => {
  it('should match the image snapshot', () => {
    const image = getImageSomehow(); // Replace with actual image retrieval logic
    expect(image).toMatchImageSnapshot();
  });
});

Custom Configuration

This feature allows you to provide custom configuration options for the image comparison, such as setting a different threshold for pixel differences or providing custom diff configurations.

import { toMatchImageSnapshot } from 'jest-image-snapshot';

describe('Custom Configuration', () => {
  it('should match the image snapshot with custom configuration', () => {
    const image = getImageSomehow(); // Replace with actual image retrieval logic
    const customConfig = { threshold: 0.1, customDiffConfig: { threshold: 0.5 } };
    expect(image).toMatchImageSnapshot(customConfig);
  });
});

Update Snapshots

This feature allows you to update the baseline image snapshot if the current image has changed and you want to accept the new image as the baseline.

import { toMatchImageSnapshot } from 'jest-image-snapshot';

describe('Update Snapshots', () => {
  it('should update the image snapshot', () => {
    const image = getImageSomehow(); // Replace with actual image retrieval logic
    expect(image).toMatchImageSnapshot({ updateSnapshot: true });
  });
});

Other packages similar to @types/jest-image-snapshot

FAQs

Package last updated on 12 Dec 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc