mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
synclink integration (#1258)
synclink integration + fixes for `py-repl` related tests and `display` tests
This commit is contained in:
28
pyscriptjs/jest-environment-jsdom.js
Normal file
28
pyscriptjs/jest-environment-jsdom.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const { TextEncoder, TextDecoder } = require('util');
|
||||
const { MessageChannel } = require('node:worker_threads');
|
||||
|
||||
const { default: $JSDOMEnvironment, TestEnvironment } = require('jest-environment-jsdom');
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true,
|
||||
});
|
||||
|
||||
class JSDOMEnvironment extends $JSDOMEnvironment {
|
||||
constructor(...args) {
|
||||
const { global } = super(...args);
|
||||
if (!global.TextEncoder) {
|
||||
global.TextEncoder = TextEncoder;
|
||||
}
|
||||
if (!global.TextDecoder) {
|
||||
global.TextDecoder = TextDecoder;
|
||||
}
|
||||
if (!global.MessageChannel) {
|
||||
global.MessageChannel = MessageChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = JSDOMEnvironment;
|
||||
exports.TestEnvironment = TestEnvironment === $JSDOMEnvironment ? JSDOMEnvironment : TestEnvironment;
|
||||
Reference in New Issue
Block a user