Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix compatibility with Ember 3.13+ #462
Ember 3.13 introduces an inaccessible WeakMap for framework-provided setters (to support tracked properties) keyed off of the owning object. Because this is the case, merely
For the method for accessing the relevant private utility function, I drew from ember-cp-validations. While I don't love the idea of using private API, I'm at least comforted in knowing that other well-used addons also seem to do it.
Ember 3.13 introduces an inaccessible WeakMap for framework-provided setters (to support tracked properties) keyed off of the owning object. Because this is the case, merely `delete`-ing an attribute from the context won't fully clean up the context; there's still a stale setter associated with the context and property name in the WeakMap. To address this, we would either need to separate the context passed down into the @ember/test-helpers setup methods from our persistent Mocha context, or dig into Ember's private API to remove these setters from the WeakMap. While neither solution seems ideal, dealing with private API has massively less surface area to maintain, since any disposable context object would have to communicate its attributes and functions back and forth from the Mocha context to the Ember context -- a task that's perhaps not even possible to get correct for all use cases. For the method for accessing the relevant private utility function, I drew from [ember-cp-validations](https://github.com/offirgolan/ember-cp-validations/blob/41158348fe8fc67ac3f3b3838dc967f5d1b7f383/addon/-private/ember-internals.js#L3-L6).
I also tested this branch against our project with email@example.com and all the tests pass (without modifying the setting and getting logic).