forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest-global.mjs
19 lines (17 loc) · 858 Bytes
/
jest-global.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
* @fileoverview Zone.js requires the `jest` global to be initialized in order to know that it must patch the environment to support Jest
* execution. When running ESM code, Jest does _not_ inject the global `jest` symbol, so Zone.js would not normally know it is running
* within Jest as users are supposed to import from `@jest/globals` or use `import.meta.jest`. Zone.js is not currently aware of this, so we
* manually set this global to get Zone.js to run correctly.
*
* TODO(dgp1130): Update Zone.js to directly support Jest ESM executions so we can drop this.
*/
// eslint-disable-next-line no-undef
globalThis.jest = import.meta.jest;