title: Karma tests NullInjectorError: No provider for InjectionToken fileName
body: <p>I know there are a few similar questions on Stackoverflow, but they don't quite answer my question.</p>
  
  <p>When running Karma tests in my Angular project, I get this error:
  <code>NullInjectorError: No provider for InjectionToken app.config!</code></p>
  
  <p>I know that in my .spec file I need to specify a provider for InjectionToken, but I am not sure on exact syntax.</p>
  
  <p>Here is my <code>app.config</code> file:</p>
  
  <pre><code>export let APP_CONFIG = new InjectionToken("app.config");
  export const AppConfig: IAppConfig = {
    relativeDateLimit: 604800000,
    dateFormat: 'MM-DD-YYYY',
    ...
  }
  export const AppConfig: IAppConfig = {
    relativeDateLimit: 604800000,
    dateFormat: 'MM-DD-YYYY',
    ...
  }
  </code></pre>
  
  <p>Then in the .component.ts file I use it like so in the constructor:</p>
  
  <pre><code>import { APP_CONFIG } from '../../app.config';
  
  constructor(@Inject(APP_CONFIG) public appConfig) {}
  </code></pre>
  
  <p>Now in the .spec.ts file for this component I know that I need to set a provider for the <code>InjectionToken</code></p>
  
  <p>I tried doing it like so:</p>
  
  <pre><code>import { InjectionToken } from "@angular/core";
  ...
  
  beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        declarations: [ RelativeDateComponent ],
        providers: [ InjectionToken ]
      })
      .compileComponents();
    }));
  </code></pre>
  
  <p>But this syntax does not work, because I also need to specify app.congig there somehow. Any help is appreciated. Thanks</p>