pass parameter to throw
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- testing
调研方向
首先查看 issue 中的 JavaScript 示例以及用于抛出错误的 assertion API。确定如何在不使用 wrapper 的情况下实现参数化的 throw assertion,然后添加覆盖测试,展示所请求的用法并确认预期的错误消息。
由索引模型根据 Issue 内容生成。
描述
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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hapijs/code 的其他 Issue
-
support
难度 3/5 1-2 天 新手友好度 38/100
-
feature
难度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
NaturalIntelligence/fast-xml-parser#888 · 1 条评论 ·
维护者通常 2 天内回复
-
bug callouts regression revealjs
难度 2/5 1-3 小时 新手友好度 72/100
quarto-dev/quarto-cli#15014 ·
维护者通常 1 天内回复
-
check:passed feeds:remove
难度 1/5 1 小时以内 新手友好度 65/100
iptv-org/database#37176 · 1 条评论 · 1 个 reaction ·
维护者通常 9 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
hawk-digital-environments/HAWKI#443 ·
维护者通常 1 天内回复
-
documentation v2
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/python-sdk#3662 ·
维护者通常 1 天内回复