Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: work with TypedArray / Array / ArrayBuffer #365

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

meowtec
Copy link

@meowtec meowtec commented Feb 22, 2025

Description

Make expect(unit8array).toMatchImageSnapshot() works.

Motivation and Context

As a web standard API, TypedArrays (Uint8Array) are widely used, especially on the browser side, and its usage is likely to increase.

For example, Puppeteer has moved from using Buffer to Uint8Array. puppeteer/puppeteer#12823
issues #357

Some arguments against using Buffer: https://sindresorhus.com/blog/goodbye-nodejs-buffer

Therefore, jest-image-snapshot should support TypedArray.

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • My changes are in sync with the code style of this project.
  • There aren't any other open Pull Requests for the same issue/update.
  • These changes should be applied to a maintenance branch.
  • I have added the Apache 2.0 license header to any new files created.

There is a PR about the same issue, but it only added some comments, why?
#364

What is the Impact to Developers Using Jest-Image-Snapshot?

@meowtec meowtec requested a review from a team as a code owner February 22, 2025 10:48
@CLAassistant
Copy link

CLAassistant commented Feb 22, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants