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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Restore Access to Utility Functions in "jest-snapshot/utils" for Continued Tooling Support #15036

Open
connectdotz opened this issue Apr 24, 2024 · 3 comments

Comments

@connectdotz
Copy link
Contributor

馃殌 Feature Proposal

Please consider re-exposing the following functions and corresponding types in jest-snapshot/utils.ts to enable tools like vscode-jest and jest-editor-support to retrieve snapshot content by test names effectively:

  • getSnapshotData
  • testNameToKey

In jest-snapshot version 27.x, these utilities were fully accessible at jest-snapshot/utils, facilitating robust tool integration. However, versions 28.x and 29.x have restricted access to these functions/types, significantly impacting tool functionality and integration.

Motivation

The primary motivation for this request is to maintain backward compatibility with existing features in community tools, such as the "view snapshot" feature in vscode-jest. This functionality, along with others, enables users to view, update, run, and debug snapshots for individual tests, is crucial for enhancing the user experience in VSCode's Jest integration.

Example

For instance, the jest-editor-support library uses functions like getSnapshotData and testNameToKey from jest-snapshot/utils to retrieve snapshot content. Here's how it's implemented in getSnapshotContent and getMetadata

Pitch

I understand the concerns about exposing unnecessary functions. However, considering their existing use within the tooling community, unless there is a better alternative, could we consider re-exposing these utility functions/types? If you agree with this proposal, I could submit a PR shortly.

@connectdotz
Copy link
Contributor Author

@SimenB do you object we re-expose these functions/types?

@mrazauskas
Copy link
Contributor

Perhaps the utils could simply be published as separate @jest/snapshot-utils package?

@connectdotz
Copy link
Contributor Author

I'm ok with either approach. @SimenB, what's your take?

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

No branches or pull requests

2 participants