Skip to content

Commit

Permalink
Fixed runtime error in TestUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Aug 17, 2023
1 parent cdc7ca5 commit c62babd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/utils/src/TestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class TestUtils {
* jest.useFakeTimers mocks `process.nextTick` by default. Hold on to a
* reference to the real function so we can still use it.
*/
static realNextTick = process.nextTick;
static realNextTick =
typeof process !== 'undefined' ? process.nextTick : undefined;

/**
* Type assertion to "cast" a function to it's corresponding jest.Mock
Expand Down Expand Up @@ -178,7 +179,7 @@ class TestUtils {
* });
*/
static async flushPromises(): Promise<void> {
await new Promise(TestUtils.realNextTick);
await new Promise(TestUtils.realNextTick ?? (() => undefined));
}

static async rightClick(
Expand Down

0 comments on commit c62babd

Please sign in to comment.