Получение ошибки после запуска теста ng Coommand - это их проблема с асинхронностью, как в моем коде? - PullRequest
0 голосов
/ 04 ноября 2019
I'm running unit test case in karma jasmine I'm getting the error
[object ErrorEvent] thrown
I have tried so many ways I didn't find any solution 


import { async, ComponentFixture, TestBed } from '@angular/core/testing';       
import { NotesHistoryComponent } from './notes-history.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing';
import { NotificationService } from 'src/app/common/notification/notification.service';
import { NgxEditorModule } from 'ngx-editor';

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

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ NotesHistoryComponent ],
      imports:[
        FormsModule,
        ReactiveFormsModule,
        CommonModule,
        HttpClientModule,
        RouterTestingModule,
        NgxEditorModule
      ],
      providers:
      [NotificationService]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(NotesHistoryComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

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

Это мой код, это их проблема с асинхронностью перед каждой функцией. Я не могу найти решение даже после создания исходной карты = false в файле karma config.js. Так что проблема с этим кодом, я не могу выяснить.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...