Add support for inline snapshots tests
オープン
まだ誰も着手していません。
feature request
never-stale
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
What is the problem this feature will solve?
Jest inline shapshots are like file-based snapshots but much more casual. I love using them for small snapshots and I think they'd be a great improvement to Node.js. From Jest's docs, they look like:
it('renders correctly', () => {
const tree = renderer
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
What is the feature you are proposing to solve the problem?
The Node.js version might look like:
test("renders correctly", async ctx => {
const tree = renderer
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
ctx.assert.snapshotInline(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
What alternatives have you considered?
I use file snapshots or assert.deepEqual().
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue にリンクされている Jest inline snapshots のドキュメントから始め、提案されている Node.js のテスト API、ctx.assert.snapshotInline と比較してください。既存の file-snapshot と assert.deepEqual の代替案を確認してください。完了条件は、例で説明されている提案済みの inline-snapshot テストフローを Node.js がサポートすることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- testing
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100