From 02b1904f5d8e4d55bfc906f8e9ea09d1562d5b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Wed, 27 Mar 2024 11:46:54 +0100 Subject: [PATCH] Using "globalThis" instead of "global" --- packages/client/src/Client.ts | 4 ++-- packages/client/src/browser/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/Client.ts b/packages/client/src/Client.ts index 18e76c0..28f2c61 100644 --- a/packages/client/src/Client.ts +++ b/packages/client/src/Client.ts @@ -239,13 +239,13 @@ export class Client extends ClientEventEmitter { const mocha = this.mockedMocha; // Building a fake file path to emit some path via events const fakeFilePath = "/mocha-remote-client/mocked-test-suite.js"; - this.suite.emit(EVENT_FILE_PRE_REQUIRE, global, fakeFilePath, mocha); + this.suite.emit(EVENT_FILE_PRE_REQUIRE, globalThis, fakeFilePath, mocha); // Assing in the context to make it available in hooks Object.assign(this.suite.ctx, context); // We're treating the value returned from the `result` as the `module.exports` from a file. const result = await this.config.tests(context); this.suite.emit(EVENT_FILE_REQUIRE, result, fakeFilePath, mocha); - this.suite.emit(EVENT_FILE_POST_REQUIRE, global, fakeFilePath, mocha); + this.suite.emit(EVENT_FILE_POST_REQUIRE, globalThis, fakeFilePath, mocha); this.debug("Loaded %d test(s)", this.suite.total()); } diff --git a/packages/client/src/browser/index.ts b/packages/client/src/browser/index.ts index 91e5ae8..0a03c1e 100644 --- a/packages/client/src/browser/index.ts +++ b/packages/client/src/browser/index.ts @@ -2,7 +2,7 @@ import { EventEmitter } from "events"; import { Client } from ".."; -Client.WebSocket = global.WebSocket; +Client.WebSocket = WebSocket; Client.EventEmitter = EventEmitter; export * from "..";