Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Unit testing controller wants logging service #4

Open
jrock2004 opened this issue Oct 11, 2017 · 1 comment
Open

Unit testing controller wants logging service #4

jrock2004 opened this issue Oct 11, 2017 · 1 comment

Comments

@jrock2004
Copy link

So I am using your plugin and when I am writing a unit test for my controller, its erroring in the test because its expecting the logging service. Here is what I have in my environment.js file

Attempting to inject an unknown injection: 'service:logger'

if (environment === 'test') {
    // Testem prefers this...
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';

    ENV['ember-logging-service'] = {
      enabled: false,
      errorsEnabled: false
    };
  }

Thoughts?

@chuckcarpenter
Copy link
Contributor

chuckcarpenter commented Nov 28, 2017

@jrock2004 if your controller is injecting the service, you'll need needs: ['service:logger'] in the unit test. Also, no way to turn it off in the test unless you're going to have some sort of mock helper.

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

No branches or pull requests

2 participants