Skip to content

Commit

Permalink
Using "globalThis" instead of "global"
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Mar 27, 2024
1 parent 1df9f63 commit 02b1904
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EventEmitter } from "events";

import { Client } from "..";

Client.WebSocket = global.WebSocket;
Client.WebSocket = WebSocket;
Client.EventEmitter = EventEmitter;

export * from "..";

0 comments on commit 02b1904

Please sign in to comment.