Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX release] Ensure ember-testing is loaded lazily
The recently modules API update means we are now loading real modules, not polyfills based on the global. This means that the modules themselves are _eagerly required_, rather than being references to a value on the global. For example, previously, this: ```js import { registerWaiter } from '@ember/test'; if (someCondition) { registerWaiter(() => {}); } ``` Would become this: ```js if (someCondition) { Ember.Test.registerWaiter(() => {}); } ``` In either example, `registerWaiter` may or may not be called based on the state of `someCondition`. However, in the second case, if `Ember.Test` is not defined at all, it's completely ok as long as `someCondition` is `false`. It's never called, so we never get an error telling us `Ember.Test` is undefined. Without the transform, the module is eagerly required, along with all of its dependencies. If no one included `ember-testing`, then that means it will throw an error immediately. This PR makes the `@ember/test` module load `ember-testing` lazily, and if it's not available (e.g. in a production environment) it replaces the values with a function that throws a helpful error.
- Loading branch information