Proposal: change default snapshot filename (~breaking)

オープン
#26 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
node.js

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
言語のデータがありません
スター
3
フォーク
4
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/test-runner のほかの issue

nodejs/test-runner の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。