Proposal: adjust snapshot file label to account for subtest label (~breaking)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 42/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript
- 領域
- testing-qa
調査の方向性
No files or tests are named. Start by locating the snapshot assertion handling and the snapshot-file reading and writing entry points in this repository. Done means subtest labels replace ordinal labels, and unchanged cases can be migrated with a console notice as described.
索引モデルが issue の本文から書いたものです。
説明
Problem(s) to solve
When a test leverages snapshot assertions, the label of the case within the snapshot file references only suite (describe) and test (it) labels, and then an integer representing the sequential position of that snapshot assertion within the test.
For example:
describe('Widget', () => {
it('should do a thing', (t) => {
t.test('db query', () => t.assert.snapshot(…));
t.test('post request', () => t.assert.snapshot(…));
});
});
Results in a snapshot file like:
exports[`Widget > should do a thing 1`] = `…`; // db query
exports[`Widget > should do a thing 2`] = `…`; // post query
When another snapshot assertion is added between them, Widget > should do a thing 2's value is changed to the new thing (and Widget > should do a thing 3 is appended with the value of what was formerly "2"). This creates two problems:
- a confusing and overly large diff
- a rather unfriendly file for a human to read
Proposed solution(s)
When a subtest wraps the snapshot assertion, use the subtest's label instead of the sequential counter:
exports[`Widget > should do a thing > db query`] = `…`;
exports[`Widget > should do a thing > post query`] = `…`;
We can mitigate a breaking change by temporarily including a migration: when reading the snapshot file, if there is an ordinal and there is a subtest, when the case value is unchanged, replace the ordinal with the subtest label and write it to disk whilst outputting a notice to the console.
- 主要言語
- 言語のデータがありません
- スター
- 3
- フォーク
- 4
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nodejs/test-runner のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
nodejs/test-runner#46 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 5/100
nodejs/test-runner#45 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 10/100
nodejs/test-runner#44 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 15/100
nodejs/test-runner#43 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 15/100
nodejs/test-runner#42 ·
nodejs/test-runner の issue をすべて見る
似ている issue
-
ai-driven-fuzzing bug claude Minor
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
linagora/open-bastion#422 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
follow-up Prio 📌
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
area-testing p2-post-1.0 technical-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
🐛 Bug: node-sqlite3 example fails on values that contain a quote対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
mochajs/mocha-examples#130 ·