It looks like '' has not been IVY compiled - it has no 'ɵcmp' field

5.6k Views Asked by At

I am currently using Angular 11. When I run the unit tests, all pass except one which says:

Error: It looks like 'ResultsService' has not been IVY compiled - it has no 'ɵcmp' field

I looked on the forums to see if anyone ran into this error but couldn't find any. Our company recently set up the Ivy Compiler to run as we've upgraded Angular in the past and it looks like it affected one of our unit tests. There's nothing much going on in the ResultsService other than testing if it was created:

import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { ResultsService } from './results.service';

describe('ResultsService', () => {
  let component: ResultsService;
  let fixture: ComponentFixture<ResultsService>;

  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      providers: [
        HttpClientTestingModule
      ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(ResultsService);
    component = fixture.componentInstance;
    fixture.detectChanges();
  })

  afterEach(() => {
    TestBed.resetTestingModule();
  });

  it('should be created', () => {
    expect(component).toBeTruthy();
  });
});

Any help would be appreciated, thanks!

0

There are 0 best solutions below