angularangular12angular-testtestbedangular14

Property 'configureTestingModule' doesn't exist on type TestBedStatic


I have updated my Angular 12 application to Angular 14 using ng update. The build was successful and can see my application running perfectly fine but my tests are failing. One of the errors I am getting is this:

Property 'configureTestingModule' doesn't exist on type TestBedStatic

Anyone know any workaround for this? Do I need to update my testing libraries?

@angular/core: ^14.2.0
jasmine-core: ~3.8.0
jasmine-marbles: ^0.8.3
karma: ~6.3.0
protractor: ^7.0.0

Sample test:

beforeEach( () => {
    TestBed.configureTestingModule({
        providers: []
    });
})

Solution

  • enter image description here

    1. download the latest typescript version npm install -g typescript

    2. type tsc --version to check the version. (currently 4.8 is the latest)

    3. click on the version in vs code and update it if it wasn't updated.

    4. If you're using npm test, then look at the typescript version in package.json