Skip to content

Commit 360f71f

Browse files
committed
treat modern timers as default, but be explicit in tests
1 parent 3dae1ec commit 360f71f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/__tests__/auto-cleanup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ test('component is automatically umounted after first test ends', () => {
3333
expect(isMounted).toEqual(false);
3434
});
3535

36-
test('does not time out with fake timers', () => {
37-
jest.useFakeTimers();
36+
test('does not time out with legacy fake timers', () => {
37+
jest.useFakeTimers('legacy');
3838
render(<Test />);
3939
expect(isMounted).toEqual(true);
4040
});
4141

42-
test('does not time out with modern fake timers', () => {
42+
test('does not time out with fake timers', () => {
4343
jest.useFakeTimers('modern');
4444
render(<Test />);
4545
expect(isMounted).toEqual(true);

src/__tests__/waitFor.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ test('waits for element with custom interval', async () => {
7979
expect(mockFn).toHaveBeenCalledTimes(3);
8080
});
8181

82-
test('works with fake timers', async () => {
83-
jest.useFakeTimers();
82+
test('works with legacy fake timers', async () => {
83+
jest.useFakeTimers('legacy');
8484

8585
const mockFn = jest.fn(() => {
8686
throw Error('test');
@@ -96,7 +96,7 @@ test('works with fake timers', async () => {
9696
expect(mockFn).toHaveBeenCalledTimes(3);
9797
});
9898

99-
test('works with modern fake timers', async () => {
99+
test('works with fake timers', async () => {
100100
jest.useFakeTimers('modern');
101101

102102
const mockFn = jest.fn(() => {

src/__tests__/waitForElementToBeRemoved.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ test('waits with custom interval', async () => {
130130
expect(mockFn).toHaveBeenCalledTimes(4);
131131
});
132132

133-
test('works with fake timers', async () => {
134-
jest.useFakeTimers();
133+
test('works with legacy fake timers', async () => {
134+
jest.useFakeTimers('legacy');
135135

136136
const mockFn = jest.fn(() => <View />);
137137

@@ -144,7 +144,7 @@ test('works with fake timers', async () => {
144144
expect(mockFn).toHaveBeenCalledTimes(4);
145145
});
146146

147-
test('works with modern fake timers', async () => {
147+
test('works with fake timers', async () => {
148148
jest.useFakeTimers('modern');
149149

150150
const mockFn = jest.fn(() => <View />);

0 commit comments

Comments
 (0)