I have tests that fails due to the following:
Error: zone-testing.js is needed for the fakeAsync() test helper but could not be found.
Please make sure that your environment includes zone.js/testing
I have tried different suggestions found online that suggests putting the following at top of test.ts:
import 'zone.js/testing';
import 'zone.js';
import { getTestBed } from '@angular/core/testing';
and
import 'zone.js/dist/zone-testing';
import 'zone.js';
import { getTestBed } from '@angular/core/testing';
Unfortunately these suggestion makes no difference. Are there any other ways that could fix my problem?
package.json
"dependencies": {
...
"zone.js": "~0.11.5"
}
"devDependencies": {
...
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
}