Proposal: change default snapshot filename (~breaking)

Offen
#26 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
52/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
node.js

Rechercherichtung

Read the snapshot implementation linked as nodejs-loaders/…/test/snapshots.mjs and trace how the default filename is generated and existing files are read. The change is complete when new snapshots use the .snap.cjs name and the proposed handling of old .snapshot files is covered without breaking existing tests.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.js → foo.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.js → foo.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.

Vorherrschende Sprache
Keine Sprachdaten
Sterne
3
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nodejs/test-runner

Alle Issues in nodejs/test-runner

Ähnliche Issues

Weitere Issues zu DevTools

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.