diff --git a/setup-jest.js b/setup-jest.js index 684d8b7bf2..4528ff46e6 100644 --- a/setup-jest.js +++ b/setup-jest.js @@ -1,3 +1,13 @@ +console.warn(` + 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(); +`); + require('zone.js'); require('zone.js/testing'); const { TextEncoder, TextDecoder } = require('util'); diff --git a/setup-jest.mjs b/setup-jest.mjs index 8ff1a7c2d0..19752ef617 100644 --- a/setup-jest.mjs +++ b/setup-jest.mjs @@ -1,8 +1,19 @@ +console.warn(` + Importing "setup-jest.mjs" directly is deprecated. The file "setup-jest.mjs" will be removed in the future. + Please use "setupZoneTestEnv" function instead. Example: + + // setup-jest.ts + import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone/index.mjs'; + + setupZoneTestEnv(); +`); + import 'zone.js'; import 'zone.js/testing'; +import { TextEncoder, TextDecoder } from 'util'; + import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -import { TextEncoder, TextDecoder } from 'util'; if (typeof globalThis.TextEncoder === 'undefined') { globalThis.TextEncoder = TextEncoder;