title: spyOn could not find an object to spy upon for start()
body: <p>I am using angular-cli testing framework.</p>
  
  <p>inside my component , I have used 'ng2-slim-loading-bar' node module.</p>
  
  <pre><code>submit(){
      this._slimLoadingBarService.start(() =&gt; {
      });
      //method operations
  }
  </code></pre>
  
  <p>Now when I am testing this component, I have applied spyOn this service as :</p>
  
  <pre><code>beforeEach(() =&gt; {
      let slimLoadingBarService=new SlimLoadingBarService();
      demoComponent = new DemoComponent(slimLoadingBarService);
      TestBed.configureTestingModule({
          declarations: [
              DemoComponent
          ],
          providers: [
              { provide: SlimLoadingBarService, useClass: SlimLoadingBarService}
          ],
          imports: [
              SharedModule
          ]
      });
  });
  it('should pass data to servie', () =&gt; {
      spyOn(slimLoadingBarService,'start').and.callThrough();
     //testing code,if I remove the above service from my component, test runs fine
  });
  </code></pre>
  
  <p>but its not working.</p>
  
  <p>It throws below error:</p>
  
  <blockquote>
    <p>spyOn could not find an object to spy upon for start()</p>
  </blockquote>