ggrossetie / opal-node-runtime

Opal Runtime for Node.js
https://opalrb.com/
MIT License
4 stars 2 forks source link

opal-runtime seems to break Chai assertion on arrays #3

Closed s-leroux closed 6 years ago

s-leroux commented 6 years ago

Hi Guillaume,

I noticed when I load the opal-runtime some assertions of the Chai testing framework break. Because of changes you made on the standard Array object prototype, I assumed.

Anyway, I submitted an issue on the Chai project: https://github.com/chaijs/chai/issues/1153

Could you check if you observe the same behavior, or if this is just something weird on my system?

ggrossetie commented 6 years ago

Hello Sylvain,

I think it's related to https://github.com/asciidoctor/asciidoctor.js/issues/299 and https://github.com/chaijs/chai/issues/1109 In short, Opal uses circular references and when you use deep equals, Chai will loop indefinitely.

s-leroux commented 6 years ago

Thank you for your replay Guillaume.

I investigate the issue a little bit more after my initial message. Apparently, after having done some tests, Chai does not break on circular references. And I follow the code on the debugger, and it does not seem to be stuck in an infinite loop.

However, I notice opal is attaching something like 800 methods to the Array and Function prototypes (or maybe just to Object?)--and a deep inspection could result in a combinatory explosion.

I assume there is no easy way to reduce the Opal footprint on the standard objects prototypes?

s-leroux commented 6 years ago

Indeed definitely the same issue as https://github.com/chaijs/chai/issues/1109

ggrossetie commented 6 years ago

The next version of Opal will fix this issue: https://github.com/opal/opal/pull/1821

ggrossetie commented 6 years ago

I believe this issue was fixed in https://github.com/Mogztter/opal-node-runtime/releases/tag/v1.0.7 Could you please give it a try (an reopen this issue if it's not the case) ?