Silent Failures of Assertions When Using --grep with Full Feature-Scenario Name
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript, node.js, typescript
調査の方向性
Feature/Scenario Outline と .steps.ts のステップ定義で問題を再現し、npx codeceptjs run --grep "Featurename: Scenarioname" とシナリオのみを実行するコマンドを比較します。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時間
- マージ済み PR(30日)
- 16
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
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
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
Add: BuyPass TV オープンchannels:add check:passed
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
S: triage
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100