Skip to content

Navigation Menu

Sign in
Sign up

Proposal: Multiple Snapshot Formats - #30

Open
avivkeller wants to merge 1 commit into
main from
proposal/multiple-snapshot-formats
Open

Proposal: Multiple Snapshot Formats #30
avivkeller wants to merge 1 commit into
main from
proposal/multiple-snapshot-formats

Conversation

@avivkeller

@avivkeller avivkeller commented Apr 8, 2026
edited
Loading

Copy link
Copy Markdown
Member

As discussed in today's meeting, I feel that we should apply the same logic that we do to finding tests that we do to finding snapshots.

As for generating them, I think we should generate the snapshot either:

  • Always CJS (Status Quo)
  • Always ESM
  • Use module from package.json
  • Use --experimental-snapshot-format=[cjs|mjs|json]
  • Use type of test (e.g. .test.cjs -> .snapshot.cjs)

There are plenty of times where it would be beneficial to support JSON snapshots (and ESM). For instance, if a non-JS runtime needs to access these files, they may not have the parsing capability to deconstruct a CJS file, but they will have the ability to read a JSON fiel.

vassudanagunta reacted with thumbs up emoji
Copilot AI review requested due to automatic review settings April 8, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a written proposal to extend the Node.js test runner’s snapshot discovery to support multiple snapshot file extensions, analogous to how test files are discovered.

Changes:

  • Introduces a new proposal document describing multi-extension snapshot resolution behavior.
  • Defines an example resolution order for snapshot extensions.
  • Provides an example error when multiple candidate snapshot files are found.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread proposals/multiple-snapshot-formats.md
Comment thread proposals/multiple-snapshot-formats.md
Comment thread proposals/multiple-snapshot-formats.md

Copy link
Copy Markdown

if a non-JS runtime needs to access these files, they may not have the parsing capability to deconstruct a CJS file, but they will have the ability to read a JSON fiel.

I've never tried, but is it easy for Javascript code to parse a CJS file, to extract structured data for analysis or reporting?

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

Reviewers

Copilot code review Copilot
Copilot review effort, defaults to Lite
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /