Skip to content

Commit 398f09a

Browse files
committed
[v13] chore: remove deprecated stuff (#1603)
* chore: remove flush microtask legacy * chore: remove deprecated *ByAccessibilityState, *ByAccessibilityValue queries * chore: add docs * docs: add docs
1 parent 430213f commit 398f09a

12 files changed

+75
-1244
lines changed

src/flush-micro-tasks.ts

-25
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,3 @@ import { setImmediate } from './helpers/timers';
33
export function flushMicroTasks() {
44
return new Promise((resolve) => setImmediate(resolve));
55
}
6-
7-
/**
8-
* @deprecated To be removed in the next major release.
9-
*/
10-
type Thenable<T> = { then: (callback: () => T) => unknown };
11-
12-
/**
13-
* This legacy implementation of `flushMicroTasks` is used for compatibility with
14-
* older versions of React Native (pre 0.71) which uses Promise polyfil.
15-
*
16-
* For users with older version of React Native there is a workaround of using our own
17-
* Jest preset instead the `react-native` one, but requiring such change would be a
18-
* breaking change for existing users.
19-
*
20-
* @deprecated To be removed in the next major release.
21-
*/
22-
export function flushMicroTasksLegacy(): Thenable<void> {
23-
return {
24-
// using "thenable" instead of a Promise, because otherwise it breaks when
25-
// using "modern" fake timers
26-
then(resolve) {
27-
setImmediate(resolve);
28-
},
29-
};
30-
}

src/helpers/wrap-async.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* istanbul ignore file */
22

33
import act, { getIsReactActEnvironment, setReactActEnvironment } from '../act';
4-
import { flushMicroTasksLegacy } from '../flush-micro-tasks';
4+
import { flushMicroTasks } from '../flush-micro-tasks';
55
import { checkReactVersionAtLeast } from '../react-versions';
66

77
/**
@@ -18,7 +18,7 @@ export async function wrapAsync<Result>(callback: () => Promise<Result>): Promis
1818
try {
1919
const result = await callback();
2020
// Flush the microtask queue before restoring the `act` environment
21-
await flushMicroTasksLegacy();
21+
await flushMicroTasks();
2222
return result;
2323
} finally {
2424
setReactActEnvironment(previousActEnvironment);

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { cleanup } from './pure';
2-
import { flushMicroTasksLegacy } from './flush-micro-tasks';
2+
import { flushMicroTasks } from './flush-micro-tasks';
33
import { getIsReactActEnvironment, setReactActEnvironment } from './act';
44

55
if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
@@ -11,7 +11,7 @@ if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
1111
if (typeof afterEach === 'function') {
1212
// eslint-disable-next-line no-undef
1313
afterEach(async () => {
14-
await flushMicroTasksLegacy();
14+
await flushMicroTasks();
1515
cleanup();
1616
});
1717
}

0 commit comments

Comments
 (0)