-
Notifications
You must be signed in to change notification settings - Fork 309
/
setup-jest.mjs
25 lines (18 loc) · 952 Bytes
/
setup-jest.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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';
if (typeof globalThis.TextEncoder === 'undefined') {
globalThis.TextEncoder = TextEncoder;
globalThis.TextDecoder = TextDecoder;
}
const testEnvironmentOptions = globalThis.ngJest?.testEnvironmentOptions ?? Object.create(null);
getTestBed().initTestEnvironment([BrowserDynamicTestingModule], platformBrowserDynamicTesting(), testEnvironmentOptions);