nodejs / nodejs/node

test_runner: `node --test` silently drops options or args in certain cases

Đang mở
#64,109 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.

Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

Version

v26.3.0

Subsystem

test_runner

What steps will reproduce the bug?

Either of the following:

node --test no-tests-here "spec/*.test.js"

node --test "spec/*.test.js" --test-reporter tap
What is the expected behavior? Why is that the expected behavior?

In the first case, since positional args are taken as a path or glob for tests to be run, each arg should result in at least one test found and successfully run, else a warning or error should be printed, e.g.:

No tests were found at "no-tests-here".

In the second case, ideally the CLI parsing is changed to allow options to come after positional args (see also #51384 and nodejs/test-runner#13), and --test-reporter tap results in the TAP test reporter being used. If that is not possible, then warnings or errors like the first case:

No tests were found at "--test-reporter".
No tests were found at "tap".

The reason for the warnings or errors is that when a positional arg does not resolve to a single test file, it is most likely a user mistake/typo, or as in the second case, the natural but incorrect assumption that options can be specified at the end.

What do you see instead?

"no-tests-here" in the first case and "--test-reporter tap" in the second are dropped without warning or error.

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.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện cả hai trường hợp bằng các lệnh node --test trong issue và lần theo cách xử lý đối số của CLI test_runner. Hoàn tất có nghĩa là các đường dẫn vị trí không bị âm thầm loại bỏ: các đường dẫn không khớp tạo ra cảnh báo hoặc lỗi, và tùy chọn reporter либо được chấp nhận sau các đối số vị trí hoặc được báo rõ ràng là không hợp lệ.

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

Đánh giá

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

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.