Open
Conversation
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
modulefrompackage.json--experimental-snapshot-format=[cjs|mjs|json].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.