js-waku/examples/min-react-js-chat/test/custom-test-env.js

13 lines
387 B
JavaScript
Raw Normal View History

2021-07-30 06:32:02 +00:00
const Environment = require('jest-environment-jsdom');
module.exports = class CustomTestEnvironment extends Environment {
async setup() {
await super.setup();
if (typeof this.global.TextEncoder === 'undefined') {
const { TextEncoder, TextDecoder } = require('util');
this.global.TextEncoder = TextEncoder;
this.global.TextDecoder = TextDecoder;
}
}
};