Skip to content

Proposal: change default snapshot filename (~breaking) #26

@JakobJingleheimer

Description

@JakobJingleheimer

Problem(s) to solve

The current default value of a snapshot filename is to append .snapshot to the name of generating file (aka a "test file"). For instance foo.test.jsfoo.test.js.snapshot.

This breaks any IDE trying to help with the file.

A snapshot file is actually a CJS file.

Proposed solution(s)

Adjust the default filename to ${TEST_FILE_BASENAME}.snap.cjs (see nodejs-loaders/…/test/snapshots.ts).

Ex foo.test.jsfoo.test.snap.cjs

IDEs recognise this and render the snapshot file as the CJS that it actually is.


We can mitigate a breaking change by detecting the old on read and renaming the file on disk whilst also outputting a message to the console.

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