Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Silent Failures of Assertions When Using --grep with Full Feature-Scenario Name

Đã đóng
#5,528 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Lĩnh vực
cli, testing

Hướng nghiên cứu

Tái hiện vấn đề với Feature/Scenario Outline và định nghĩa step trong .steps.ts, bằng cách so sánh npx codeceptjs run --grep "Featurename: Scenarioname" với lệnh chỉ chạy scenario. Bắt đầu từ phần xử lý --grep của CLI và theo dõi cách việc khớp feature-scenario đầy đủ thực thi các assertion và ghi lại kết quả. Hoàn tất khi các assertion thất bại được báo cáo chính xác và lần chạy không còn hiển thị OK | 0 passed gây hiểu lầm.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

stale

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
  1. Define a Feature and Scenario Outline in a .feature file
  2. Add a step definition for the Scenario that contains a false node assertion in a .steps.ts file
  3. 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 show OK | 0 passed even if the whole test should have failed.
  4. If the same test is run with just the scenario name filter:
    npx codeceptjs run --grep "Scenarioname"
    The test executes correctly, fails and prints FAIL | 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

Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
756
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codeceptjs/CodeceptJS

Tất cả issue của codeceptjs/CodeceptJS

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.