Silent Failures of Assertions When Using --grep with Full Feature-Scenario Name
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- javascript, node.js, typescript
调研方向
使用 Feature/Scenario Outline 和 .steps.ts 中的步骤定义复现该问题,并将 npx codeceptjs run --grep "Featurename: Scenarioname" 与仅运行 scenario 的命令进行比较。从 CLI 的 --grep 处理开始,跟踪完整的 feature-scenario 匹配如何执行 assertion 并记录结果。完成标准是失败的 assertion 能够被正确报告,并且运行结果不再显示误导性的 OK | 0 passed。
由索引模型根据 Issue 内容生成。
描述
Summary
I am encountering an issue when running specific scenarios with the --grep flag. Specifically, when using npx codeceptjs run --grep "Featurename: Scenarioname", node assertions like assert.equal(1,2) are not being processed correctly and test failures are silent. However, running the same test with npx codeceptjs run --grep "Scenarioname" works as expected. Since a couple of versions CodeceptJS gives the first command as a suggestion if no matching scenario was found for a test run:
No tests found by pattern: /Featurename: Scenarioname_misspelled/
Maybe you wanted to run one of these tests?
...
To run the first test use the following command:
npx codeceptjs run --debug --grep "Featurename: Scenarioname "
This issue leads to assertions seemingly passing, and the test run result shows a green OK | 0 passed, despite a failure condition and the test run itself being aborted correctly.
If a pattern is suggested for use, it should work as expected and handle failing assertions correctly, which in this case it does not.
Steps to Reproduce
- Define a Feature and Scenario Outline in a .feature file
- Add a step definition for the Scenario that contains a false node assertion in a .steps.ts file
- Run CodeceptJS with the full feature-scenario name as a filter:
npx codeceptjs run --grep "Featurename: Scenarioname"
If the assertion evaluates to a failure the test will silently pass, and the terminal will showOK | 0 passedeven if the whole test should have failed. - If the same test is run with just the scenario name filter:
npx codeceptjs run --grep "Scenarioname"
The test executes correctly, fails and printsFAIL | 0 passed, 1 failed.
Code Example
Feature File:
Feature: Billing
As a user, I want to do billing calculations.
Scenario Outline: Monthly <usecase>
Given I am on page billing
When I settle the bill
Then I see that the number of billed items <billedItems> is correct
Examples:
| usecase | dateFrom | dateTo | billedItems |
| Normal | 2023-01-01| 2023-01-31 | 10 |
Step Definition:
import assert from "node:assert"
....
Then("I see that the number of billed items {int} is correct", async (billedItems: number) => {
assert.equal(billedItems, 10); // Example check, should fail if numbers don't match
})
Expected Behavior
When running npx codeceptjs run --grep "Featurename: Scenarioname", the assertions should execute, and any failures should be properly tracked and printed by CodeceptJS.
The output should show either 1 failed or 1 passed, depending on the assertion and should not silently fail with 0 passed.
Environment
CodeceptJS version: 3.7.8
Node.js version: v25.9.0
- 主要语言
- JavaScript
- 星标
- 4.2k
- 派生
- 756
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codeceptjs/CodeceptJS 的其他 Issue
-
stale
难度 2/5 1-3 小时 新手友好度 72/100
codeceptjs/CodeceptJS#5420 · 1 条评论 ·
-
stale
难度 2/5 1-3 小时 新手友好度 76/100
codeceptjs/CodeceptJS#5358 · 1 条评论 ·
-
stale
难度 2/5 1-3 小时 新手友好度 78/100
codeceptjs/CodeceptJS#4958 · 10 条评论 · 2 个 reaction ·
-
stale
难度 1/5 1 小时以内 新手友好度 72/100
codeceptjs/CodeceptJS#4778 · 3 条评论 ·
-
stale
难度 4/5 3-5 天 新手友好度 38/100
codeceptjs/CodeceptJS#5618 · 1 条评论 ·
查看 codeceptjs/CodeceptJS 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
palladius/rails8-app-on-gcp#145 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
难度 2/5 1-3 小时 新手友好度 65/100
web-platform-tests/interop#1455 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
corsairdev/corsair#1764 ·
-
难度 2/5 1-3 小时 新手友好度 75/100