Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度单元测试:TypeError:env.catchExceptions不是函数_Angular_Unit Testing_Jasmine_Karma Jasmine - Fatal编程技术网

Angular 角度单元测试:TypeError:env.catchExceptions不是函数

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链接之后,当我

我为Angular应用程序编写了一些单元测试,当我运行
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,因此我将处理它。