Open archive-me opened 4 years ago
when i want to run ng test, the output karma is: The pipe 'translate' could not be found ... my .spec.ts file
ng test
`import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {DashboardComponent} from './dashboard.component';
describe('DashboardComponent', () => { let component: DashboardComponent; let fixture: ComponentFixture;
beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [DashboardComponent] }) .compileComponents(); }));
beforeEach(() => { fixture = TestBed.createComponent(DashboardComponent); component = fixture.componentInstance; fixture.detectChanges(); });
it('should create', () => { expect(component).toBeTruthy(); }); }); `
output karma:
You have to import the TranslateModule:
TranslateModule
beforeEach(async(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [DashboardComponent] }) .compileComponents(); }));
when i want to run
ng test
, the output karma is: The pipe 'translate' could not be found ... my .spec.ts file`import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {DashboardComponent} from './dashboard.component';
describe('DashboardComponent', () => { let component: DashboardComponent; let fixture: ComponentFixture;
beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [DashboardComponent] }) .compileComponents(); }));
beforeEach(() => { fixture = TestBed.createComponent(DashboardComponent); component = fixture.componentInstance; fixture.detectChanges(); });
it('should create', () => { expect(component).toBeTruthy(); }); }); `
output karma: