首页 > 解决方案 > 尝试运行 ng test 时出错:应该创建 FAILED

问题描述

错误:无法将 @Input 装饰器与查询装饰器结合使用

我的规范文件(没有做任何更改):

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

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ LoginComponent ]
    })
    .compileComponents();
  }));

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

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

组件文件(完全为空):

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss']
})
export class LoginComponent  {

}

标签: angulartestingjasminekarma-jasmine

解决方案


推荐阅读