Files
cloudbeaver/webapp/packages/core-cli/tests/test.environment.js
T
sergeyteleshevands.teleshev 3274988d4a CB-4551 unit tests form timestampToDate and cacheValue (#2316)
* CB-4551 unit tests form timestampToDate and cacheValue

* CB-4551 cacheValue added one more test case

* CB-4551 removed unused plugins for tests

* CB-4551 all tests has UTC timezone

* СB-4551 fix: icons has no data-test id

---------

Co-authored-by: s.teleshev <s.teleshev@mu.se>
2024-01-22 14:10:23 +03:00

20 lines
704 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;
// different machine has its own timezones and some tests can fail because of it
process.env.TZ = 'UTC';
}
};