Use source loader for email sprite icons
[ProtonMail-WebClient.git] / packages / jest-env / index.js
blob071ac5b807082d565558d3d59d79af5cbf5bb9e4
1 // Stolen from: https://github.com/ipfs/jest-environment-aegir/blob/master/src/index.js
2 // Overcomes error from jest internals.. this thing: https://github.com/facebook/jest/issues/6248
3 // Mostly needed for making OpenPGP.js works
5 const JSDOMEnvironment = require('jest-environment-jsdom').default;
7 class MyEnvironment extends JSDOMEnvironment {
8     constructor({ globalConfig, projectConfig }, context) {
9         super(
10             {
11                 globalConfig,
12                 projectConfig: {
13                     ...projectConfig,
14                     globals: {
15                         ...projectConfig.globals,
16                         Uint32Array,
17                         Uint8Array,
18                         ArrayBuffer,
19                         TextDecoder,
20                         TextEncoder,
21                         ReadableStream,
22                         Response,
23                         Request,
24                         BroadcastChannel,
25                         TransformStream,
26                         fetch,
27                         structuredClone,
28                     },
29                 },
30             },
31             context
32         );
33     }
35     async setup() {} // eslint-disable-line
37     async teardown() {} // eslint-disable-line
40 module.exports = MyEnvironment;