Jasmine 如何修复[karma server]:未捕获异常

Jasmine 如何修复[karma server]:未捕获异常,jasmine,angular-cli,karma-jasmine,karma-runner,Jasmine,Angular Cli,Karma Jasmine,Karma Runner,我正在运行Angular 9应用程序,我正在jasmine中运行单元测试,使用以下命令运行测试,一切正常: ng test 但是,当我使用watch=false运行单元测试时,所有测试都通过了,但最后我得到了“UncaughtException” ng test --watch=false // using this command in SonarQube to generate UT report 由于上述错误,SonarQube未生成UT报告 有没有办法获取错误的详细信息(日志文件或

我正在运行Angular 9应用程序,我正在jasmine中运行单元测试,使用以下命令运行测试,一切正常:

ng test
但是,当我使用watch=false运行单元测试时,所有测试都通过了,但最后我得到了“UncaughtException

ng test --watch=false // using this command in SonarQube to generate UT report

由于上述错误,SonarQube未生成UT报告

有没有办法获取错误的详细信息(日志文件或其他内容)或调试[karma server]“UncaughtException error…?

我从以下规范文件中获取错误:

配置文件组件规范ts

describe('Client.App.Advanced.ProfileComponent', () => {
    let component: ProfileComponent;
    let fixture: ComponentFixture<ProfileComponent>;
    let httpMock: HttpTestingController;

    function mockHttp(data) {
        const mockReq = httpMock.expectOne((req) => true);
        mockReq.flush(data);
        httpMock.verify();
    }

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            imports: [HttpClientTestingModule, RouterTestingModule],
            declarations: [ProfileComponent],
            providers: [ProfileToolHandlerService ]
        }).compileComponents();
    }));

    beforeEach(fakeAsync(() => {
        httpMock = TestBed.inject<HttpTestingController>(HttpTestingController);
        fixture = TestBed.createComponent(ProfileComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
        // mock request for Login
        mockHttp(null);
        tick();
    }));

    it('shall create the component', () => {
        fixture.detectChanges();
        expect(component).toBeDefined();
    });
}
description('Client.App.Advanced.ProfileComponent',()=>{
let组件:ProfileComponent;
let夹具:组件夹具;
让httpock:HttpTestingController;
函数mockHttp(数据){
常量mockReq=httpMock.expectOne((req)=>true);
mockReq.flush(数据);
httpMock.verify();
}
beforeach(异步(()=>{
TestBed.configureTestingModule({
导入:[HttpClientTestingModule,RouterTestingModule],
声明:[ProfileComponent],
提供者:[ProfileToolHandlerService]
}).compileComponents();
}));
beforeach(fakeAsync(()=>{
httpMock=TestBed.inject(HttpTestingController);
fixture=TestBed.createComponent(ProfileComponent);
组件=fixture.componentInstance;
fixture.detectChanges();
//模拟登录请求
mockHttp(null);
勾选();
}));
它('应创建组件',()=>{
fixture.detectChanges();
expect(component.toBeDefined();
});
}

您可能会发现有趣的事情。这似乎是karma runner的一个随机事件。我的一些回购协议中始终看到了这一点。从未得到修复。对我来说,这是在添加配置文件规范文件后发生的。如果我对该文件进行注释并运行所有其他测试,我不会得到[karma error]:Uncaught exception您可能会觉得有趣。这似乎是karma runner的一个随机事件。我看到它与我的一些回购一致。从未得到修复。对我来说,这是在添加配置文件规范文件后发生的。如果我对该文件进行注释并运行所有其他测试,我不会得到[karma error]:Uncaught exception