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

fix(expect): support expect.addSnapshotSerializer #6173

Merged
merged 8 commits into from
Nov 6, 2024

Conversation

eryue0220
Copy link
Contributor

Part of #3964, support expect.addSnapshotSerializer api.

@eryue0220
Copy link
Contributor Author

The error about typo checking has submitted in this pr #6171.

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.48%. Comparing base (d57a66c) to head (b2112a7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6173      +/-   ##
==========================================
- Coverage   96.51%   96.48%   -0.03%     
==========================================
  Files         538      535       -3     
  Lines       41276    41204      -72     
  Branches     6162     6160       -2     
==========================================
- Hits        39837    39756      -81     
- Misses       1395     1404       +9     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eryue0220 eryue0220 marked this pull request as draft November 4, 2024 08:24
@eryue0220 eryue0220 marked this pull request as ready for review November 4, 2024 10:16
expect/expect.ts Outdated
* `expect.addSnapshotSerializer` adds a module that formats application-specific data structures.
*
* For an individual test file, an added module precedes any modules from snapshotSerializers configuration,
* which precede the default snapshot serializers for built-in JavaScript types and for React elements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing for React elements part as that phrase feels strange in this repo.

@@ -915,3 +915,5 @@ export interface OldSnapshotPlugin {
) => string;
test: Test;
}

export type SnapshotPlugin = NewSnapshotPlugin | OldSnapshotPlugin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is OldSnapshotPlugin still common? How about only supporting NewSnapshotPlugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I checked some serialize plugins, they still use OldSnapshottPlugin type definition, like:

jest-serializer-vue
jest-serializer-html
jest-serializer-react-helmet
jest-snapshot-serializer-ansi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@kt3k kt3k merged commit e7c6d36 into denoland:main Nov 6, 2024
19 checks passed
@eryue0220 eryue0220 deleted the fix/expect-add-snapshot-serialize branch November 6, 2024 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants