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 "..";