expect().toThrow(): support checking properties
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- testing
調査の方向性
まず expect().toThrow() の実装と、その matcher のテストを見つけます。要求されている Error プロパティのチェックと、callback または返されたエラーを使う代替案を比較し、メッセージの一致と cause などのプロパティのチェックをカバーするテストによって、サポートする動作を 1 つ定義します。
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
I can check that something will throw but I don't see a straightforward way to check properties on the thrown exception.
Describe the solution you'd like
expect(someFn).toThrow(new Error("kaboom", { cause: new TypeError("bad input") }));
or some way to pass in a function to toThrow() or to get the thrown exception to check things:
expect(someFn).toThrow(new Error("kaboom"), (e) => {
// more assertions, e.g. on `e.cause`
});
const thrownError = expect(someFn).toThrow(new Error("kaboom"));
// more assertions, e.g. on `thrownError.cause`
Describe alternatives you've considered
- Calling the function direclty myself and wrapping with
try...catch(I have to remember to add an explicitfail()if the function doesn't throw, otherwise the test may pass with a false positive). - Using some setup with a spy to catch the exception… not sure if that is a thing yet or not.
- 主要言語
- TypeScript
- スター
- 3.6k
- フォーク
- 713
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
denoland/std のほかの issue
-
`assertEquals` throws on structurally equal `Error` objects due to different stack trace対応中かも @powerman2026 が 1 日前に担当しました。 オープンbug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
streams: DelimiterStream leaves delimiter bytes in the output when the delimiter spans more than two chunks対応中かも @helmipradita が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
@std/encoding: decodeAscii85 corrupts delimited data ending in "<", decodeVarint32 reads past the end of the buffer対応中かも @helmipradita が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
@std/yaml: stringify() with condenseFlow wraps already quoted keys in a second pair of quotes対応中かも @sebxt が 35 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
@std/ini parse silently drops an entire section when the section name repeats対応中かも @Harsh23Kashyap が 35 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
security: set top-level least-privilege permissions in five workflows対応中かも @JonathanTSilva が今日担当しました。 オープンpriority: p2 size: xs type: security
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
JonathanTSilva/jts-website#150 ·
メンテナーはふだん 1 日以内に返信
-
bug Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
scottbenton/Iron-Link#437 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
speakeasy-api/speakeasy#2159 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vercel-labs/ui#1066 ·
メンテナーはふだん 1 日以内に返信