`assertEquals` could return `Promise` for `Blob` comparison

オープン
#6,774 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
deno, typescript
領域
testing

調査の方向性

まず assertEquals のドキュメントと issue #6202 からリンクされている議論を確認し、その後、現在のアサーション API と Blob の比較動作を追跡します。既存の呼び出し元に受け入れられない影響を与えることなく、非同期で Promise を返す API を通じてネストされた Blob 値を比較できるかどうかを明らかにできれば完了です。

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

説明

Is your feature request related to a problem? Please describe.

Documentation of assertEquals says:

Note: When comparing Blob objects, you should first convert them to Uint8Array using the Blob.bytes() method and then compare their contents.

But what if one wants to compare whole objects that must contain Blobs as property values in a quite deep level of nesting?

Describe the solution you'd like

assertEquals should be able to return Promise<void> to defer such comparison.

In https://github.com/denoland/std/issues/6202#issuecomment-2498053184, @kt3k said that changing assertEquals to async would be a large impact, but it seems unclear how large; the current return type of assertEquals is just void, so no one is supposed to use the return value. And of course non-async part of assertion can still be done synchronously before returning a Promise. Users who don't use Blobs wouldn't have to await assertEquals.

Describe alternatives you've considered

To write assertEquals for every single leaf property of the objects in concern, which is catastrophically painful.

主要言語
TypeScript
スター
3.6k
フォーク
713
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

denoland/std のほかの issue

denoland/std の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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