Line returns added in serialized function when running through jest
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
- 领域
- backend
调研方向
从 issue 中描述的 Jest 测试复现开始,并将其输出与独立 Node.js 的结果以及链接的 gist 进行比较。通过 Jest 运行时,序列化示例能够生成预期的函数格式且不会插入换行符,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 2.9k
- 派生
- 215
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
yahoo/serialize-javascript 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
yahoo/serialize-javascript#230 ·
-
Ad java script 未关闭
难度 5/5 一周以上 新手友好度 20/100
yahoo/serialize-javascript#212 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
yahoo/serialize-javascript#208 · 10 条评论 · 25 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
yahoo/serialize-javascript#195 ·
-
难度 3/5 1-2 天 新手友好度 45/100
yahoo/serialize-javascript#182 ·
查看 yahoo/serialize-javascript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1414 ·
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·