У меня есть указанная выше тестовая база, настроенная в приложении Angular Cli 6.0.1.
Использование Jasmine V2.8.0 и Karma V2.0.0
В строке 13 появляется следующая ошибка
Error: Cannot create the component AddressLookUpDirective as it was not imported into the testing module!
Не могу понять, что не так ... любые предложения приветствуются
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { AddressLookUpDirective } from './address-look-up.directive';
describe('AddressLookUpDirective', () => {
let component: AddressLookUpDirective;
let fixture: ComponentFixture<AddressLookUpDirective>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AddressLookUpDirective
]
});
fixture = TestBed.createComponent(AddressLookUpDirective);
component = fixture.componentInstance;
});
});
@vincecampanale Нет, но есть селектор @Directive({ selector: '[addressLookUp]' })





Вы должны создать фиктивный компонент для тестирования директив и импортировать как директиву, так и фиктивный компонент в TestBed.
@Component({
template: `<input type = "text" hoverfocus>`
})
class TestHoverFocusComponent {
}
@ см. https://codecraft.tv/courses/angular/unit-testing/directives/
Есть ли в декораторе
AddressLookUpDirectiveсвойствоtemplateUrlилиstyleUrls?