I've been trying to get this to work,the service tests that only depended on the httpclient worked fine. Yet when I try to test a component with some dependencies like this (I don't even need to put the test itself for the errors to show):
describe('test suite name', () => {
let component: ExampleComponent;
let fixture: ComponentFixture<ExampleComponent>;
let testBed;
let dependencyMock = jasmine.createSpyObj('Dependency', ['action']);
beforeEach(async () => {
testBed = await TestBed.configureTestingModule({
declarations: [ExampleComponent],
providers: [
{ provide: Dependency, useValue: dependencyMock }
],
imports: [
// FormsModule,
// MatDialogModule,
// BrowserModule,
// BrowserAnimationsModule,
],
}).compileComponents();
});
});
A multitude of errors show up in the console with nearly all of them being of this type:
app/someRandomLocation/RandomFile.component.ts:7:30 - error TS2307: Cannot find module 'src/app/someOtherRandomLocation/AnotherRandomFile.ts'.
7 import { AnotherRandomFile } from 'src/app/someOtherRandomLocation/AnotherRandomFile';
I've tried to put AppModule in the imports to check if it solved the problem, it just gave me more errors.
This is a project where there are multiple *Module files to separate them a bit.
Does anybody know what I'm doing wrong?
Aucun commentaire:
Enregistrer un commentaire