caolan / caolan/nodeunit

Run object instead of runFiles?

Đang mở
#105 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
1.9k
Fork
359
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In nodeunit, whenever you call

nodeunit.reporters["default"].run(["a","b"]);

it will always, eventually, require("a") as a test and run it, then require("b") and then run it.

What if you want to load files on your own, or even define tests in memory, never saving to a file? As an example, I could see loading a file, doing some manipulation, and only then passing it through to nodeunit.

In this scenario, the two run() calls below would be equivalent:

var a = require("a");
nodeunit.reporters["default"].run(["a"]);
nodeunit.reporters["default"].runModule(a);

But the second option gives me the ability to do:

var a = require("a");
a.doSomeMod();
nodeunit.reporters["default"].runModule(a);

Even better, you don't need runModule. All you need is for run() to check each option in the array; if it is a string, require() it as a file, else just use it as is.

Whole change set could probably be done in nodeunit.js ll 61-81.

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu trong nodeunit.js, khoảng các dòng 61–81, và kiểm tra cách phương thức run của reporter mặc định xử lý mảng đầu vào của nó cũng như require các tệp kiểm thử. So sánh các trường hợp module dựa trên tệp và module trong bộ nhớ được yêu cầu, sau đó xác minh rằng cả hai dạng đều thực thi chính xác và hành vi hiện có vẫn được giữ nguyê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
backend, testing-qa
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 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.