@testing-library/react-native 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/act.d.ts +8 -3
- package/build/act.js +73 -2
- package/build/act.js.map +1 -1
- package/build/cleanup.js.map +1 -1
- package/build/fireEvent.js +17 -7
- package/build/fireEvent.js.map +1 -1
- package/build/flushMicroTasks.js.map +1 -1
- package/build/helpers/accessiblity.d.ts +2 -0
- package/build/helpers/accessiblity.js +60 -0
- package/build/helpers/accessiblity.js.map +1 -0
- package/build/helpers/component-tree.d.ts +29 -0
- package/build/helpers/component-tree.js +90 -0
- package/build/helpers/component-tree.js.map +1 -0
- package/build/helpers/debugDeep.js.map +1 -1
- package/build/helpers/debugShallow.js.map +1 -1
- package/build/helpers/errors.d.ts +2 -2
- package/build/helpers/errors.js.map +1 -1
- package/build/helpers/filterNodeByType.d.ts +1 -1
- package/build/helpers/filterNodeByType.js.map +1 -1
- package/build/helpers/format.js.map +1 -1
- package/build/helpers/matchers/matchArrayProp.js.map +1 -1
- package/build/helpers/matchers/matchObjectProp.js.map +1 -1
- package/build/helpers/matchers/matchStringProp.js.map +1 -1
- package/build/helpers/stringValidation.d.ts +2 -0
- package/build/helpers/stringValidation.js +38 -0
- package/build/helpers/stringValidation.js.map +1 -0
- package/build/helpers/timers.js.map +1 -1
- package/build/index.flow.js +50 -31
- package/build/index.js +27 -11
- package/build/index.js.map +1 -1
- package/build/matches.js.map +1 -1
- package/build/pure.d.ts +5 -3
- package/build/pure.js +8 -0
- package/build/pure.js.map +1 -1
- package/build/queries/a11yState.js.map +1 -1
- package/build/queries/a11yValue.js.map +1 -1
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/hintText.js.map +1 -1
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/makeQueries.js.map +1 -1
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.d.ts +10 -6
- package/build/queries/role.js +13 -2
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.js.map +1 -1
- package/build/queries/unsafeProps.js.map +1 -1
- package/build/queries/unsafeType.js.map +1 -1
- package/build/react-versions.d.ts +1 -0
- package/build/react-versions.js +19 -0
- package/build/react-versions.js.map +1 -0
- package/build/render.d.ts +21 -8
- package/build/render.js +37 -1
- package/build/render.js.map +1 -1
- package/build/renderHook.d.ts +3 -4
- package/build/renderHook.js.map +1 -1
- package/build/screen.js.map +1 -1
- package/build/shallow.js.map +1 -1
- package/build/waitFor.js +14 -11
- package/build/waitFor.js.map +1 -1
- package/build/waitForElementToBeRemoved.js.map +1 -1
- package/build/within.d.ts +18 -6
- package/build/within.js.map +1 -1
- package/package.json +22 -19
- package/typings/index.flow.js +50 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -34,46 +34,49 @@
|
|
|
34
34
|
"@babel/preset-flow": "^7.9.0",
|
|
35
35
|
"@babel/preset-react": "^7.9.4",
|
|
36
36
|
"@babel/preset-typescript": "^7.16.0",
|
|
37
|
-
"@callstack/eslint-config": "^
|
|
38
|
-
"@release-it/conventional-changelog": "^2.0.0",
|
|
37
|
+
"@callstack/eslint-config": "^13.0.1",
|
|
39
38
|
"@testing-library/jest-native": "~4.0.2",
|
|
40
|
-
"@types/jest": "^
|
|
41
|
-
"@types/react": "
|
|
42
|
-
"@types/react-native": "
|
|
43
|
-
"@types/react-test-renderer": "
|
|
44
|
-
"babel-jest": "^
|
|
45
|
-
"conventional-changelog-cli": "^2.
|
|
46
|
-
"cp-cli": "^2.0.0",
|
|
39
|
+
"@types/jest": "^29.0.2",
|
|
40
|
+
"@types/react": "~18.0.18",
|
|
41
|
+
"@types/react-native": "~0.70.0",
|
|
42
|
+
"@types/react-test-renderer": "~18.0.0",
|
|
43
|
+
"babel-jest": "^29.0.3",
|
|
44
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
47
45
|
"dedent": "^0.7.0",
|
|
48
|
-
"del-cli": "^
|
|
49
|
-
"eslint": "^
|
|
46
|
+
"del-cli": "^5.0.0",
|
|
47
|
+
"eslint": "^8.21.0",
|
|
50
48
|
"flow-bin": "~0.170.0",
|
|
51
49
|
"flow-copy-source": "^2.0.9",
|
|
52
|
-
"jest": "^
|
|
53
|
-
"react": "
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-test-renderer": "
|
|
56
|
-
"release-it": "^14.0.3",
|
|
50
|
+
"jest": "^29.0.3",
|
|
51
|
+
"react": "18.1.0",
|
|
52
|
+
"react-native": "0.70.0",
|
|
53
|
+
"react-test-renderer": "18.1.0",
|
|
57
54
|
"strip-ansi": "^6.0.0",
|
|
58
55
|
"typescript": "^4.0.2"
|
|
59
56
|
},
|
|
60
57
|
"dependencies": {
|
|
61
|
-
"pretty-format": "^
|
|
58
|
+
"pretty-format": "^29.0.3"
|
|
62
59
|
},
|
|
63
60
|
"peerDependencies": {
|
|
61
|
+
"jest": ">=28.0.0",
|
|
64
62
|
"react": ">=16.0.0",
|
|
65
63
|
"react-native": ">=0.59",
|
|
66
64
|
"react-test-renderer": ">=16.0.0"
|
|
67
65
|
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"jest": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
68
71
|
"scripts": {
|
|
69
72
|
"clean": "del build",
|
|
70
73
|
"test": "jest",
|
|
71
74
|
"test:ci": "jest --maxWorkers=2",
|
|
75
|
+
"test:ci:react:17": "scripts/test_react_17",
|
|
72
76
|
"typecheck": "tsc",
|
|
73
77
|
"flow": "flow",
|
|
74
78
|
"copy-flowtypes": "cp typings/index.flow.js build",
|
|
75
79
|
"lint": "eslint src --cache",
|
|
76
|
-
"release": "release-it",
|
|
77
80
|
"prepublish": "yarn build",
|
|
78
81
|
"build:js": "babel src --out-dir build --extensions \".js,.ts,.jsx,.tsx\" --source-maps --ignore \"**/__tests__/**\"",
|
|
79
82
|
"build:js:watch": "yarn build:js --watch",
|
package/typings/index.flow.js
CHANGED
|
@@ -68,6 +68,7 @@ type WaitForOptions = {
|
|
|
68
68
|
interval?: number,
|
|
69
69
|
onTimeout?: (error: mixed) => Error,
|
|
70
70
|
};
|
|
71
|
+
|
|
71
72
|
type WaitForFunction = <T = any>(
|
|
72
73
|
expectation: () => T,
|
|
73
74
|
options?: WaitForOptions
|
|
@@ -201,6 +202,11 @@ interface UnsafeByPropsQueries {
|
|
|
201
202
|
| Array<ReactTestInstance>
|
|
202
203
|
| [];
|
|
203
204
|
}
|
|
205
|
+
|
|
206
|
+
interface ByRoleOptions {
|
|
207
|
+
name?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
204
210
|
interface A11yAPI {
|
|
205
211
|
// Label
|
|
206
212
|
getByLabelText: (matcher: TextMatch) => GetReturn;
|
|
@@ -243,16 +249,27 @@ interface A11yAPI {
|
|
|
243
249
|
) => FindAllReturn;
|
|
244
250
|
|
|
245
251
|
// Role
|
|
246
|
-
getByRole: (matcher: A11yRole | RegExp) => GetReturn;
|
|
247
|
-
getAllByRole: (
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
getByRole: (matcher: A11yRole | RegExp, role?: ByRoleOptions) => GetReturn;
|
|
253
|
+
getAllByRole: (
|
|
254
|
+
matcher: A11yRole | RegExp,
|
|
255
|
+
role?: ByRoleOptions
|
|
256
|
+
) => GetAllReturn;
|
|
257
|
+
queryByRole: (
|
|
258
|
+
matcher: A11yRole | RegExp,
|
|
259
|
+
role?: ByRoleOptions
|
|
260
|
+
) => QueryReturn;
|
|
261
|
+
queryAllByRole: (
|
|
262
|
+
matcher: A11yRole | RegExp,
|
|
263
|
+
role?: ByRoleOptions
|
|
264
|
+
) => QueryAllReturn;
|
|
250
265
|
findByRole: (
|
|
251
266
|
matcher: A11yRole | RegExp,
|
|
267
|
+
role?: ByRoleOptions,
|
|
252
268
|
waitForOptions?: WaitForOptions
|
|
253
269
|
) => FindReturn;
|
|
254
270
|
findAllByRole: (
|
|
255
271
|
matcher: A11yRole | RegExp,
|
|
272
|
+
role?: ByRoleOptions,
|
|
256
273
|
waitForOptions?: WaitForOptions
|
|
257
274
|
) => FindAllReturn;
|
|
258
275
|
|
|
@@ -289,11 +306,6 @@ interface Thenable {
|
|
|
289
306
|
then: (resolve: () => any, reject?: () => any) => any;
|
|
290
307
|
}
|
|
291
308
|
|
|
292
|
-
interface RenderOptions {
|
|
293
|
-
wrapper?: React.ComponentType<any>;
|
|
294
|
-
createNodeMock?: (element: React.Element<any>) => any;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
309
|
type Debug = {
|
|
298
310
|
(message?: string): void,
|
|
299
311
|
shallow: (message?: string) => void,
|
|
@@ -307,15 +319,6 @@ type Queries = ByTextQueries &
|
|
|
307
319
|
UnsafeByPropsQueries &
|
|
308
320
|
A11yAPI;
|
|
309
321
|
|
|
310
|
-
interface RenderAPI extends Queries {
|
|
311
|
-
update(nextElement: React.Element<any>): void;
|
|
312
|
-
rerender(nextElement: React.Element<any>): void;
|
|
313
|
-
unmount(nextElement?: React.Element<any>): void;
|
|
314
|
-
toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
|
|
315
|
-
debug: Debug;
|
|
316
|
-
container: ReactTestInstance;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
322
|
type FireEventFunction = (
|
|
320
323
|
element: ReactTestInstance,
|
|
321
324
|
eventName: string,
|
|
@@ -328,24 +331,29 @@ type FireEventAPI = FireEventFunction & {
|
|
|
328
331
|
scroll: (element: ReactTestInstance, ...data: Array<any>) => any,
|
|
329
332
|
};
|
|
330
333
|
|
|
331
|
-
type RenderHookResult<Result, Props> = {
|
|
332
|
-
rerender: (props: Props) => void,
|
|
333
|
-
result: { current: Result },
|
|
334
|
-
unmount: () => void,
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
type RenderHookOptions<Props> = {
|
|
338
|
-
initialProps?: Props,
|
|
339
|
-
wrapper?: React.ComponentType<any>,
|
|
340
|
-
};
|
|
341
|
-
|
|
342
334
|
declare module '@testing-library/react-native' {
|
|
335
|
+
declare interface RenderResult extends Queries {
|
|
336
|
+
update(nextElement: React.Element<any>): void;
|
|
337
|
+
rerender(nextElement: React.Element<any>): void;
|
|
338
|
+
unmount(nextElement?: React.Element<any>): void;
|
|
339
|
+
toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
|
|
340
|
+
debug: Debug;
|
|
341
|
+
container: ReactTestInstance;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare type RenderAPI = RenderResult;
|
|
345
|
+
|
|
346
|
+
declare interface RenderOptions {
|
|
347
|
+
wrapper?: React.ComponentType<any>;
|
|
348
|
+
createNodeMock?: (element: React.Element<any>) => any;
|
|
349
|
+
}
|
|
350
|
+
|
|
343
351
|
declare export var render: (
|
|
344
352
|
component: React.Element<any>,
|
|
345
353
|
options?: RenderOptions
|
|
346
|
-
) =>
|
|
354
|
+
) => RenderResult;
|
|
347
355
|
|
|
348
|
-
declare export var screen:
|
|
356
|
+
declare export var screen: RenderResult;
|
|
349
357
|
|
|
350
358
|
declare export var cleanup: () => void;
|
|
351
359
|
declare export var fireEvent: FireEventAPI;
|
|
@@ -369,6 +377,17 @@ declare module '@testing-library/react-native' {
|
|
|
369
377
|
normalizerConfig?: NormalizerConfig
|
|
370
378
|
) => NormalizerFn;
|
|
371
379
|
|
|
380
|
+
declare type RenderHookResult<Result, Props> = {
|
|
381
|
+
rerender: (props: Props) => void,
|
|
382
|
+
result: { current: Result },
|
|
383
|
+
unmount: () => void,
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
declare type RenderHookOptions<Props> = {
|
|
387
|
+
initialProps?: Props,
|
|
388
|
+
wrapper?: React.ComponentType<any>,
|
|
389
|
+
};
|
|
390
|
+
|
|
372
391
|
declare type RenderHookFunction = <Result, Props>(
|
|
373
392
|
renderCallback: (props: Props) => Result,
|
|
374
393
|
options?: RenderHookOptions<Props>
|