Angular 角度单元测试:TypeError:env.catchExceptions不是函数
我为Angular应用程序编写了一些单元测试,当我运行Angular 角度单元测试:TypeError:env.catchExceptions不是函数,angular,unit-testing,jasmine,karma-jasmine,Angular,Unit Testing,Jasmine,Karma Jasmine,我为Angular应用程序编写了一些单元测试,当我运行ng test时,它们都通过了,这很好。但是,由于最后抛出错误,测试仍然被视为未成功: An error was thrown in afterAll TypeError: env.catchExceptions is not a function 经过一些研究,我发现这句话的意思是降级到jasmine 2.99,但它对我不起作用 我正在使用Angular 10,并使用Jasmine和Karma进行测试。在github链接之后,当我
ng test
时,它们都通过了,这很好。但是,由于最后抛出错误,测试仍然被视为未成功:
An error was thrown in afterAll
TypeError: env.catchExceptions is not a function
经过一些研究,我发现这句话的意思是降级到jasmine 2.99,但它对我不起作用
我正在使用Angular 10,并使用Jasmine和Karma进行测试。在github链接之后,当我遇到同样的错误时,将follow dev依赖项更改为这些版本对我很有效
- “@types/jasmine”:“~2.8.8”
- “@types/jasminewd2”:“~2.0.3”
- “茉莉花芯”:“~2.99.1”
- “jasmine spec reporter”:“~4.2.1”
- “因果报应茉莉”:“~1.1.2”
- “karma jasmine html reporter”:“^0.2.2”
我也遇到了同样的问题,注意到您的版本与我的版本一样,只是我有
jasmine@3.6.3
。我收到的错误似乎提到了html reporter,因此我将处理它。