jeudi 26 avril 2018

No provider for TestingCompilerFactory

This is my test file and I am trying to identify the error preventing me from running a successful test:

    import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Component, Directive, Input, OnInit } from '@angular/core';
import { TestComponent } from './test.component';
import { NgbDropdownModule, NgbCollapse } from '@ng-bootstrap/ng-bootstrap';
import { CommonModule } from '@angular/common';
import { Routes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';

import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';


let comp: TestComponent;
let fixture: ComponentFixture<MyComponent>;

describe('TestComponent', () => {
   beforeEach(() =>  {
      TestBed.configureTestingModule({
        declarations: [ TestComponent ],
        providers: [
           // DECLARE PROVIDERS HERE
          { provide: TestingCompilerFactory }
        ]
      }).compileComponents()
      .then(() => {
        fixture = TestBed.createComponent(TestComponent);
        comp    = fixture.componentInstance;
      });
    }));
    it('should be created', () => {
      expect(TestComponent).toBeTruthy();
    });

I am getting this error which I guess is because I am not wrapping it correctly.

error  TS1005: ';' expected. 

But I also get

No provider for TestingCompilerFactory

Aucun commentaire:

Enregistrer un commentaire