Ошибка при загрузке: Uncaught Error: описать без дочерних элементов

Что я делаю неправильно?

У меня есть один файл с тестом - Strategy.spec.ts

      import { StrategyComponent } from './strategy.component';

describe(' get true number ', () => {
  let strategy: StrategyComponent;
});

файл karma.conf.js

      module.exports = function (config) {
  config.set({
    basePath: "../..",
    frameworks: ["jasmine"],
  });
};

Я получаю ошибку в karma-localhost (url - http://localhost:9876/)

      0 specs, 1 failure, randomized with seed 93967

Error during loading: Uncaught Error: describe with no children
(describe() or it()): get true number in 
http://localhost:9876/base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?5a831622ecb7c749ca96e36d473ee583ebf6298b 
line 10042

2 ответа

если я пишу так шаблон-тест, я не получаю ошибку

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

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [StrategyComponent],
      imports: [TooltipComponent],
    }).compileComponents();

    fixture = TestBed.createComponent(StrategyComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

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

Вам не хватает блоков (фактических тестов) в вашемdescribe()блок, отсюда и ошибка.

Добавление одного теста с помощьюit()Блок должен решить проблему.

Другие вопросы по тегам