Reputation: 1266
After starting Jest (in my case version 29.7.0), the following message appears:
Importing "setup-jest.js" directly is deprecated. The file "setup-jest.js" will be removed in the future.
Please use "setupZoneTestEnv" function instead. Example:
// setup-jest.ts
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
setupZoneTestEnv();
What's the problem? How can I fix this?
I already removed the setupFilesAfterEnv
property from jest.config.js
that brought up another message.
Upvotes: 0
Views: 437
Reputation: 1266
The solution was to change this line in setup-jest.ts:
import 'jest-preset-angular/setup-jest';
to this solution (so please delete the line above:
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
setupZoneTestEnv();
Upvotes: 0