0

What I do wrong?

I have one file with test - strategy.spec.ts

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

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

file karma.conf.js

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

I get error in 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
Roma N
  • 175
  • 11

2 Answers2

0

if i write so template-test, I don't get error

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();
  });
});
Roma N
  • 175
  • 11
-1

You are missing it() blocks (actual tests) in your describe() block, hence the error.

Adding a single test using an it() block should fix the problem.

Romain
  • 54
  • 1