TestBedStatic 类型上不存在属性“configureTestingModule”

Aay*_*ain 4 testbed angular angular-test angular12 angular14

我已使用 Angular 12 应用程序将 Angular 12 应用程序更新为 Angular 14 ng update。构建成功,可以看到我的应用程序运行得很好,但我的测试失败了。我遇到的错误之一是:

TestBedStatic 类型上不存在属性“configureTestingModule”

有人知道这个问题有什么解决方法吗?我需要更新我的测试库吗?

@angular/core: ^14.2.0
jasmine-core: ~3.8.0
jasmine-marbles: ^0.8.3
karma: ~6.3.0
protractor: ^7.0.0
Run Code Online (Sandbox Code Playgroud)

样品测试:

beforeEach( () => {
    TestBed.configureTestingModule({
        providers: []
    });
})
Run Code Online (Sandbox Code Playgroud)

Rst*_*r37 5

在此输入图像描述

  1. 下载最新的打字稿版本npm install -g typescript

  2. 键入tsc --version以检查版本。(目前最新的是4.8)

  3. 点击VS Code中的版本,如果没有更新就更新一下。

  4. 如果您使用的是npm test,请查看 package.json 中的 typescript 版本