Skip to content

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

@connectdotz

Description

@connectdotz

🚀 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions