Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

pass parameter to throw

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

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

評価

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

調査の方向性

まず、issue の JavaScript の例と、throw されたエラーに対する assertion API を確認します。ラッパーなしでパラメーター化された throw assertion を実現する方法を検討し、要求された使い方を示して期待されるエラーメッセージを確認するテストカバレッジを追加します。

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

説明

feature
Support plan
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no
Context
  • node version: > 18.13.0
  • module version: ^9.02
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi
  • any other relevant information:
What problem are you trying to solve?

I am testing a function that requires me to pass a parameter to it. In certain cases it will throw an Error. I am unable to test this function without making a wrapper for it.

const foo = (message) => {
  throw Error(message)
}

let msg = "sup hapi devs" 
expect(foo(msg)).to.throw(msg) // Epic fail

const wrapper = () => foo(msg)
expect(wrapper).to.throw(msg) // Success! 
Do you have a new or modified API suggestion to solve the problem?

I'll look into it, just wanted to see if this concern is legitimate.

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

環境構築

はじめの一歩

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

hapijs/code のほかの issue

hapijs/code の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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