mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
* CB-4818 refactor: update NPM dependencies * CB-4818 chore: update react-data-grid fork * CB-4818 fix: tests --------- Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
22 lines
811 B
JavaScript
22 lines
811 B
JavaScript
const Environment = require('jest-environment-jsdom').default;
|
|
|
|
/**
|
|
JSDOM does not have an implementation for TextDecoder / TextEncoder present on their globals
|
|
and therefore not only are they not found, but you can't add them without access to their global context inside the VM.
|
|
MSW 2.0 related issue.
|
|
*/
|
|
module.exports = class CustomTestEnvironment extends Environment {
|
|
async setup() {
|
|
await super.setup();
|
|
this.global.TextEncoder = TextEncoder;
|
|
this.global.TextDecoder = TextDecoder;
|
|
this.global.Response = Response;
|
|
this.global.Request = Request;
|
|
// FIXME https://github.com/jsdom/jsdom/issues/3363
|
|
this.global.structuredClone = structuredClone;
|
|
|
|
// different machine has its own timezones and some tests can fail because of it
|
|
process.env.TZ = 'UTC';
|
|
}
|
|
};
|