Open Gaurav0 opened 6 years ago
@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.
Confirmed. I see this in my apps as well. Is there a workaround?
Can a deprecated property like @each
be enumerable: false
?
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! 😯
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))
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).
I think that https://github.com/emberjs/ember.js/issues/17190#issuecomment-440717625 is the same issue here.
This seems like a regression of the fixes in https://github.com/emberjs/ember.js/pull/16169 which was specifically trying to address this issue...
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.