Incorrect prototype check
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
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- testing
Hướng nghiên cứu
Tái hiện lỗi bằng ví dụ Node được cung cấp, sau đó kiểm tra lib/index.js quanh các dòng 139 và 239 cũng như thiết lập comparePrototypes. Hoàn tất khi phép so sánh thành công mà không có lỗi đối với các đối tượng lồng nhau có prototype null khi comparePrototypes là false.
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
- is this issue affecting a production system? no
Context
- node version: 18.x
- module version with issue: 9.0.3
- last module version without issue: NA
- environment (e.g. node, browser, native): node
- used with
@hapi/[email protected] - any other relevant information: NA
What are you trying to achieve or the steps to reproduce?
The module does not ignore the prototype during a comparison.
const Code = require('@hapi/code');
const noProto = Object.create(null);
noProto.a = Object.create(null);
noProto.a.b = 1;
Code.settings.comparePrototypes = false;
Code.expect([noProto]).to.once.include({ a: { b: 1 } });
** By using simple objects {} the comparison works as expected.
What was the result you got?
/Users/manuel_spigolon/dev/misc/hapi/code/lib/index.js:139
throw error;
^
Error: Expected [ [Object: null prototype] { a: [Object: null prototype] { b: 1 } } ] to include { a: { b: 1 } } once
at internals.Assertion.internals.include (/Users/manuel_spigolon/dev/misc/hapi/code/lib/index.js:239:17)
at Object.<anonymous> (/Users/manuel_spigolon/dev/misc/hapi/code/asd.js:8:32)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
actual: undefined,
expected: undefined,
}
What result did you expect?
No error due to the default comparePrototypes = false setting
- Ngôn ngữ chính
- JavaScript
- Star
- 231
- Fork
- 75
- 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/code
-
pass parameter to throwĐang mởfeature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Issue tương tự
-
Remove: Fox Deportes SDĐang mởcheck:passed feeds:remove
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
iptv-org/database#37176 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hawk-digital-environments/HAWKI#443 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
feedback simulation workshop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
githubnext/gh-aw-workshop#4370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AltimateAI/vscode-dbt-power-user#2089 ·