Line returns added in serialized function when running through jest
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
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với bản tái hiện bài kiểm thử Jest được mô tả trong issue và so sánh đầu ra của nó với kết quả Node.js độc lập và gist được liên kết. Được xem là hoàn thành khi ví dụ được tuần tự hóa tạo ra định dạng hàm mong đợi mà không chèn ngắt dòng khi chạy qua Jest.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I always get the weirdest issues. So, serialize-javascript works fine in actual production, but it somehow outputs a different thing while running a test. In the example of the object with all the types including the function, I get an odd line return within the serialized function.
Environment:
- Node 14.13.0
- Jest 26.5.2
- serialize-javascript 5.0.1
Reproduction:
(Alternatively, see https://gist.github.com/eslachance/6dbd88820f09de4509d4f19c4c0e7ad6 for reproduction)
- Create a jest test
- import serialize-javascript
- Add a console.log of the serialized example.
test("serializes javascript", () => {
console.log(serialize({
str : 'string',
num : 0,
obj : {foo: 'foo'},
arr : [1, 2, 3],
bool : true,
nil : null,
undef: undefined,
inf : Infinity,
date : new Date("Thu, 28 Apr 2016 22:02:17 GMT"),
map : new Map([['hello', 'world']]),
set : new Set([123, 456]),
fn : function echo(arg) { return arg; },
re : /([^\s]+)/g,
big : BigInt(10),
}))
});
Expected result:
{"str":"string","num":0,"obj":{"foo":"foo"},"arr":[1,2,3],"bool":true,"nil":null,"undef":undefined,"inf":Infinity,"date":new Date("2016-04-28T22:02:17.000Z"),"map":new Map([["hello","world"]]),"set":new Set([123,456]),"fn":function echo(arg) { return arg; },"re":new RegExp("([^\\s]+)", "g"),"big":BigInt("10")}
Actual Result:
{"str":"string","num":0,"obj":{"foo":"foo"},"arr":[1,2,3],"bool":true,"nil":null,"undef":undefined,"inf":Infinity,"date":new Date("2016-04-28T22:02:17.000Z"),"map":new Map([["hello","world"]]),"set":new Set([123,456]),"fn":function echo(arg) {
return arg;
},"re":new RegExp("([^\\s]+)", "g"),"big":BigInt("10")}
The expected result was a simple nodejs file which outputs the serialized data and nothing else.
This is confusing me very much, and I don't know where to begin in troubleshooting it.
- Ngôn ngữ chính
- JavaScript
- Star
- 2.9k
- Fork
- 215
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 2
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
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 yahoo/serialize-javascript
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
yahoo/serialize-javascript#230 ·
-
Ad java script Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
yahoo/serialize-javascript#212 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
yahoo/serialize-javascript#208 · 10 bình luận · 25 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
yahoo/serialize-javascript#195 ·
-
Serialize regexp to literal Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
yahoo/serialize-javascript#182 ·
Tất cả issue của yahoo/serialize-javascript
Issue tương tự
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Improve Title Support Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·