Skip to content

Commit

Permalink
fix: allow writing to performance global
Browse files Browse the repository at this point in the history
  • Loading branch information
prichey committed Jan 26, 2024
1 parent 7bc5560 commit a961e35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { getHeapStatistics } from 'v8';

import { wait } from './util';

// otherwise, TypeError: Cannot assign to read only property 'performance' of object '[object global]'
Object.defineProperty(global, 'performance', {
writable: true,
});

// mocks the setTimeout function, see https://jestjs.io/docs/timer-mocks
jest.useFakeTimers();
jest.spyOn(global, 'setTimeout');
Expand Down

0 comments on commit a961e35

Please sign in to comment.