📜  使用 jasmine 和 karma 进行单元测试时发生 CUSTOM_ELEMENTS_SCHEMA 错误 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:22.845000             🧑  作者: Mango

代码示例1
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './../app.component';
import { RouterTestingModule } from '@angular/router/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

describe('AppComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
      declarations: [AppComponent],
      imports: [RouterTestingModule]
    });
    TestBed.compileComponents();
  });