nodejs / nodejs/node

test runner (--test, node:test) subtest test context lack `.skip`, `.only` and `.todo` functions

Đang mở
#50,665 6 bình luận 5 reaction 0 người được giao Xem trên GitHub

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

confirmed-bug test_runner
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

20.7.0

Platform

Linux void-desktop 6.5.9_1 #1 SMP PREEMPT_DYNAMIC Thu Oct 26 12:11:50 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?
const test = require('node:test');

test('Parent', t => {
	t.test.only('Child only', () => {});
	t.test.skip('Child skip', () => {});
	t.test.todo('Child todo', () => {});
});

Run with node --test <file> (same result without the --test flag)

How often does it reproduce? Is there a required condition?

Consistently

What is the expected behavior? Why is that the expected behavior?

All functions work as described here: https://nodejs.org/docs/latest-v20.x/api/test.html#subtests

This method behaves identically to the top level test() function. The following example demonstrates the creation of a top level test with two subtests.

What do you see instead?
TypeError [Error]: t.test.todo is not a function
TypeError [Error]: t.test.skip is not a function
TypeError [Error]: t.test.only is not a function
Additional information

These functions work for top-level test, they don't work for nested tests.
Maybe it doesn't make sense to expose those functions for subtests (use just describe - maybe it's enough), but in that case the documentation is misleading

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 tại điểm truy cập API subtest của node:test và tái hiện bài kiểm thử lồng nhau được cung cấp bằng node --test hoặc không có flag. So sánh hành vi được ghi lại trong tài liệu của t.test.only, t.test.skip và t.test.todo với các TypeErrors quan sát được; hoàn tất khi hành vi của API lồng nhau và tài liệu thống nhất về hành vi dự kiến.

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
testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/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.