Skip to content

Commit fba015c

Browse files
author
Shreyas-Microsoft
committed
define MessagePort
1 parent f69bde1 commit fba015c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

frontend/jest.polyfills.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ Object.defineProperties(globalThis, {
1616
TransformStream: { value: TransformStream },
1717
})
1818

19+
const { MessageChannel } = require('worker_threads');
20+
21+
Object.defineProperties(globalThis, {
22+
MessageChannel: { value: MessageChannel },
23+
MessagePort: { value: MessageChannel.prototype.port1.constructor },
24+
});
25+
1926
const { TextDecoder, TextEncoder } = require('node:util')
2027

2128
Object.defineProperties(globalThis, {

0 commit comments

Comments
 (0)