Skip to content

Commit 8502cfd

Browse files
author
Shane Osbourne
committed
prototype directly
1 parent 49bbf73 commit 8502cfd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/messaging/lib/test-utils.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,23 @@ export function wrapWindowsScripts(js, replacements) {
154154
delete window.chrome.webview.addEventListener;
155155
delete window.chrome.webview.removeEventListener;
156156
if (typeof Bluetooth === 'undefined') {
157+
globalThis.Bluetooth = {};
157158
globalThis.Bluetooth.prototype = { requestDevice: async () => { /* noop */ } }
158159
}
159160
// @ts-expect-error - testing
160161
if (typeof USB === 'undefined') {
162+
globalThis.USB = {};
161163
globalThis.USB.prototype = { requestDevice: async () => { /* noop */ } }
162164
}
163165
164166
// @ts-expect-error - testing
165167
if (typeof Serial === 'undefined') {
168+
globalThis.Serial = {};
166169
globalThis.Serial.prototype = { requestPort: async () => { /* noop */ } }
167170
}
168171
// @ts-expect-error - testing
169172
if (typeof HID === 'undefined') {
173+
globalThis.HID = {};
170174
globalThis.HID.prototype = { requestDevice: async () => { /* noop */ } }
171175
}
172176
${js}

0 commit comments

Comments
 (0)