Testing Components that use ember-debug-logger
I have a component, I happily have this.debug("yay!"); inside of it.
When I run the test for the component I see:
Died on test #1 http://localhost:7357/assets/tests.js:1175:24
exports@http://localhost:7357/assets/vendor.js:140:37
requireModule@http://localhost:7357/assets/vendor.js:32:25
require@http://localhost:7357/assets/test-support.js:7124:14
loadModules@http://localhost:7357/assets/test-support.js:7116:21
load@http://localhost:7357/assets/test-support.js:7146:33
http://localhost:7357/assets/test-support.js:7030:22: undefined is not a constructor (evaluating 'this.debug("yay!")')
Log: |
...
any simple recommended way to get around this?
(i've tried the simple this.set('debug', etc); to no avail)
Unfortunately the way this addon relies on an instance initializer right now makes this a little tricky to pull off. I think something like this ought to work in a component test, though:
import { initialize } from 'ember-debug-logger/instance-initializers/debug-logger';
// ...
beforeEach() {
initialize(Ember.getOwner(this));
}
The better approach from this end might be to just reopen the relevant classes in a bare module, so you could just import it for the side effect in your test-helper.js. I'll plan to investigate that when I get a chance, but I'd also happily accept a PR in the meantime :)