Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 在当前 value 中的出现的函数是当前的 key 时, 不应有引用关系 #65

Open
wll8 opened this issue Oct 24, 2020 · 1 comment
Labels
bug Something isn't working future Later processing

Comments

@wll8
Copy link
Contributor

wll8 commented Oct 24, 2020

问题简述
如果当前键的 key pick 是 mock 的生成函数, 则不应该出现递归引用. 否则导致循环引用而导致崩溃: Maximum call stack size exceeded .

{
  "pick": " @pick(['a', 'b'])"
}

复现步骤
点此 打开控制台粘贴以下代码:

s = Mock.mock({
  "pick": "@pick(['a', 'b'])"
})
console.log(s) // a
s = Mock.mock({
  "pick": " @pick(['a', 'b'])"
})
console.log(s) // Maximum call stack size exceeded

期望结果

s = Mock.mock({
  "pick": "@pick(['a', 'b'])"
})
console.log(s) // a
s = Mock.mock({
  "pick": " @pick(['a', 'b'])"
})
console.log(s) //  a

环境

  • Env: chrome 版本 86.0.4240.75(正式版本) (64 位)
  • OS: win10x64
  • better-mock version: better-mock@0.2.9
@wll8 wll8 added the bug Something isn't working label Oct 24, 2020
@lavyun
Copy link
Owner

lavyun commented Oct 26, 2020

先暂时使用 @PICK 代替解决,后续优化

@lavyun lavyun added the future Later processing label Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working future Later processing
Projects
None yet
Development

No branches or pull requests

2 participants