devcontainers / devcontainers/cli
[Features][test-lib] Add message arg to the check function
- 主要语言
- TypeScript
- 星标
- 3k
- 派生
- 457
- 平均合并
- 13 小时 17 分钟
- 30 天内合并 PR
- 6
描述
I would like to propose a change to the check function of the dev-container-features-test-lib script.
The function should take a message to display when the test fails, like other testing frameworks have.
The current function code is:
https://github.com/devcontainers/cli/blob/c246645f97fba402c3b1b95983e573e92bcec464/src/spec-node/featuresCLI/utils.ts#L75-L91
I propose to add a message on $2 or the last argument.
Any thoughts on this?
I would suggest something like this:
```bash
check() {
LABEL=$1
MESSAGE = $2 or ${!#}
#
# the rest of the function
#
}
```
The new function should work like the examples below, and be backwards compatible
```bash
old:
check "java version LTS installed as default" \
grep "LTS" <(java --version)
new:
check "java version LTS installed as default" \
grep "LTS" <(java --version) \
"REASON: The installed version is: $(java --version)"
or
check "java version LTS installed as default" \
"REASON: The installed version is: $(java --version)" \
grep "LTS" <(java --version)
```
贡献指南
调研方向
从 src/spec-node/featuresCLI/utils.ts#L75-L91 开始,检查现有功能测试如何调用 check 函数。定义如何将可选消息与命令参数区分开来,保留当前的调用形式,并验证失败的检查会显示所提供的消息。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell, typescript
- 领域
- testing-qa
- Issue 类型
- 功能
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100