Supply AbortController signal to tests
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
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu bằng cách truy vết cách tham số test flags và phần xử lý onCleanup hiện có được triển khai. Kiểm tra các test liên quan đến hành vi cleanup, sau đó thêm signal của AbortController vào các flags được truyền cho test và xác minh rằng lab hủy nó khi cleanup chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Support plan
- is this issue currently blocking your project? (yes/no): no
- is this issue affecting a production system? (yes/no): no
Context
- node version: 14+
- module version: 24.3.2
- environment (e.g. node, browser, native): node 14+
- used with (e.g. hapi application, another framework, standalone, ...):
- any other relevant information:
What problem are you trying to solve?
Simpler cleanup of failed (or time outed) tests.
Do you have a new or modified API suggestion to solve the problem?
Add an AbortController signal property to the flags parameter. This way a test can pass it on, eg.:
it('performs a fetch', async ({ signal }) => {
const req = http.request('http://example.org', { signal });
const [res] = await Events.onceee(req, 'response'); // Crashes since `onceee` does not exist.
expect(res.statusCode).to.equal(200);
});
Without the signal, the code crashes before any event emitters are added, which obviously causes the test to fail. However, the request continues processing. If it errors at any point, it will cause a process uncaughtException, which will cause whatever subsequent test that is running to fail.
With the signal, which lab should trigger at the same time as calling onCleanup, it will be guaranteed to cause a process uncaughtException, but this time it should be an immediate AbortError which can be ignored, causing no further harm. This is on top of the obvious effect of aborting the no longer relevant request.
Note: This feature overlaps with the existing onCleanup flag. Any code using non-async onCleanup, can assign the logic as an event listener:
it('does something', async ({ signal }) => {
signal.addEventListener('abort', () => {
/* onCleanup logic goes here */
});
// or even simpler
signal.onabort = () => {
/* onCleanup logic goes here */
};
});
- Ngôn ngữ chính
- JavaScript
- Star
- 737
- Fork
- 177
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hapijs/lab
-
remove eslint from dep, add as peer depCó thể làm lại được @Marsup đã nhận 600 ngày trước và không có pull request nào đang mở. Đang mởfeature
-
support
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
support
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
support
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Issue tương tự
-
good first issue
Độ khó 2/5 3-5 ngày Mức phù hợp với người mới 62/100
paipai1999/POS-system#3 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
r-afael/better-yt-recommendations#36 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
microsoft/playwright#43875 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cli good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Run the dependency drift checkCó thể đã có người làm @spaceninja đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
cloudfour/stylelint-config-cloudfour#683 ·
Maintainer thường phản hồi trong vòng 1 ngày