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

Using sinon triggers deprecation warnings in tests. #17046

Open
Gaurav0 opened this issue Oct 5, 2018 · 6 comments
Open

Using sinon triggers deprecation warnings in tests. #17046

Gaurav0 opened this issue Oct 5, 2018 · 6 comments

Comments

@Gaurav0
Copy link
Contributor

Gaurav0 commented Oct 5, 2018

See reproduction (open console): https://ember-twiddle.com/969a3d23d9ef9b6ae643cff85cb07183?openFiles=twiddle.json%2C

sinon enumerates objects and thus finds and accesses deprecated properties, causing deprecation warnings in tests.

@pixelhandler
Copy link
Contributor

@Gaurav0 yeah I see this in the console:

DEPRECATION: Getting the '@each' property on object  is deprecated [deprecation id: ember-metal.getting-each] See https://emberjs.com/deprecations/v3.x#toc_getting-the-each-property for more details.

And when I remove sinon as a dependency the deprecation is gone.

@sukima
Copy link
Contributor

sukima commented Nov 28, 2018

Confirmed. I see this in my apps as well. Is there a workaround?

Can a deprecated property like @each be enumerable: false?

@backspace
Copy link

Thanks for opening this, I’m finding this too while working on fixing deprecations while updating travis-web to 3.6. I was surprised that the documentation says it’ll be removed in Ember 3.5 as we’re already on that version! 😯

@runspired
Copy link
Contributor

So roughly the issue here is that sinon wraps the modules and tries to clone the prototypes of each property of default exports in order to prepare for stubbing. That in turn results in the following call that iterates ownPropertyNames which accesses the "deprecated setter" for @each when wrapping that module.

return Object.getOwnPropertyNames(u).reduce(function(l, n) {
                    return "size" !== n && "caller" !== n && "callee" !== n && "arguments" !== n && "function" == typeof u[n] && (l[n] = e.bind(u[n])),
                    l
                }, Object.create(null))

@sukima
Copy link
Contributor

sukima commented Dec 10, 2018

In other words, either @each needs to be configured enumerable: false (invasive)

OR

Ignore the deprecation warning and it will go away once @each is removed (passive).

@rwjblue
Copy link
Member

rwjblue commented Dec 10, 2018

I think that #17190 (comment) is the same issue here.

This seems like a regression of the fixes in #16169 which was specifically trying to address this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants