Skip to content

Commit

Permalink
Merge pull request #3458 from preactjs/fix-clock
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Feb 19, 2022
2 parents a2ad860 + 266f8bf commit 77c6243
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions debug/test/browser/debug.options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ describe('debug options', () => {
/** @type {(count: number) => void} */
let setCount;

/** @type {import('sinon').SinonFakeTimers | undefined} */
let clock;

beforeEach(() => {
scratch = setupScratch();
rerender = setupRerender();
Expand All @@ -39,6 +42,7 @@ describe('debug options', () => {

afterEach(() => {
teardown(scratch);
if (clock) clock.restore();
});

class ClassApp extends Component {
Expand Down Expand Up @@ -119,7 +123,7 @@ describe('debug options', () => {
}
}

const clock = sinon.useFakeTimers();
clock = sinon.useFakeTimers();

render(<ErrorApp />, scratch);
rerender();
Expand All @@ -129,7 +133,5 @@ describe('debug options', () => {
// we expect to throw after setTimeout to trigger a window.onerror
// this is to ensure react compat (i.e. with next.js' dev overlay)
expect(() => clock.tick(0)).to.throw(e);

clock.restore();
});
});

0 comments on commit 77c6243

Please sign in to comment.