@testing-library/react-native 11.3.0 → 11.5.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.
Files changed (126) hide show
  1. package/README.md +5 -2
  2. package/build/act.js +9 -15
  3. package/build/act.js.map +1 -1
  4. package/build/cleanup.d.ts +1 -1
  5. package/build/cleanup.js +0 -4
  6. package/build/cleanup.js.map +1 -1
  7. package/build/config.d.ts +15 -2
  8. package/build/config.js +16 -8
  9. package/build/config.js.map +1 -1
  10. package/build/fireEvent.js +3 -31
  11. package/build/fireEvent.js.map +1 -1
  12. package/build/flushMicroTasks.d.ts +1 -1
  13. package/build/flushMicroTasks.js +0 -3
  14. package/build/flushMicroTasks.js.map +1 -1
  15. package/build/helpers/accessiblity.d.ts +10 -1
  16. package/build/helpers/accessiblity.js +28 -24
  17. package/build/helpers/accessiblity.js.map +1 -1
  18. package/build/helpers/component-tree.js +6 -27
  19. package/build/helpers/component-tree.js.map +1 -1
  20. package/build/helpers/debugDeep.d.ts +5 -1
  21. package/build/helpers/debugDeep.js +7 -6
  22. package/build/helpers/debugDeep.js.map +1 -1
  23. package/build/helpers/debugShallow.js +0 -5
  24. package/build/helpers/debugShallow.js.map +1 -1
  25. package/build/helpers/errors.js +4 -25
  26. package/build/helpers/errors.js.map +1 -1
  27. package/build/helpers/filterNodeByType.js +0 -2
  28. package/build/helpers/filterNodeByType.js.map +1 -1
  29. package/build/helpers/findAll.d.ts +10 -0
  30. package/build/helpers/findAll.js +44 -0
  31. package/build/helpers/findAll.js.map +1 -0
  32. package/build/helpers/format.d.ts +5 -1
  33. package/build/helpers/format.js +17 -7
  34. package/build/helpers/format.js.map +1 -1
  35. package/build/helpers/getTextContent.d.ts +2 -0
  36. package/build/helpers/getTextContent.js +20 -0
  37. package/build/helpers/getTextContent.js.map +1 -0
  38. package/build/helpers/matchers/accessibilityState.d.ts +3 -0
  39. package/build/helpers/matchers/accessibilityState.js +28 -0
  40. package/build/helpers/matchers/accessibilityState.js.map +1 -0
  41. package/build/helpers/matchers/accessibilityValue.d.ts +9 -0
  42. package/build/helpers/matchers/accessibilityValue.js +12 -0
  43. package/build/helpers/matchers/accessibilityValue.js.map +1 -0
  44. package/build/helpers/matchers/matchArrayProp.js +0 -3
  45. package/build/helpers/matchers/matchArrayProp.js.map +1 -1
  46. package/build/helpers/matchers/matchObjectProp.js +0 -2
  47. package/build/helpers/matchers/matchObjectProp.js.map +1 -1
  48. package/build/helpers/matchers/matchStringProp.js +0 -3
  49. package/build/helpers/matchers/matchStringProp.js.map +1 -1
  50. package/build/helpers/matchers/matchTextContent.d.ts +3 -0
  51. package/build/helpers/matchers/matchTextContent.js +22 -0
  52. package/build/helpers/matchers/matchTextContent.js.map +1 -0
  53. package/build/helpers/stringValidation.js +0 -7
  54. package/build/helpers/stringValidation.js.map +1 -1
  55. package/build/helpers/timers.js +10 -21
  56. package/build/helpers/timers.js.map +1 -1
  57. package/build/index.flow.js +169 -56
  58. package/build/index.js +0 -6
  59. package/build/index.js.map +1 -1
  60. package/build/matches.d.ts +7 -3
  61. package/build/matches.js +2 -4
  62. package/build/matches.js.map +1 -1
  63. package/build/pure.d.ts +12 -23
  64. package/build/pure.js +8 -15
  65. package/build/pure.js.map +1 -1
  66. package/build/queries/a11yState.d.ts +15 -14
  67. package/build/queries/a11yState.js +16 -13
  68. package/build/queries/a11yState.js.map +1 -1
  69. package/build/queries/a11yValue.d.ts +15 -20
  70. package/build/queries/a11yValue.js +16 -13
  71. package/build/queries/a11yValue.js.map +1 -1
  72. package/build/queries/displayValue.d.ts +11 -9
  73. package/build/queries/displayValue.js +2 -12
  74. package/build/queries/displayValue.js.map +1 -1
  75. package/build/queries/hintText.d.ts +23 -20
  76. package/build/queries/hintText.js +11 -11
  77. package/build/queries/hintText.js.map +1 -1
  78. package/build/queries/labelText.d.ts +11 -8
  79. package/build/queries/labelText.js +11 -11
  80. package/build/queries/labelText.js.map +1 -1
  81. package/build/queries/makeQueries.d.ts +9 -9
  82. package/build/queries/makeQueries.js +40 -24
  83. package/build/queries/makeQueries.js.map +1 -1
  84. package/build/queries/options.d.ts +11 -0
  85. package/build/queries/options.js +2 -0
  86. package/build/queries/options.js.map +1 -0
  87. package/build/queries/placeholderText.d.ts +11 -9
  88. package/build/queries/placeholderText.js +2 -12
  89. package/build/queries/placeholderText.js.map +1 -1
  90. package/build/queries/role.d.ts +7 -3
  91. package/build/queries/role.js +32 -13
  92. package/build/queries/role.js.map +1 -1
  93. package/build/queries/testId.d.ts +11 -9
  94. package/build/queries/testId.js +3 -11
  95. package/build/queries/testId.js.map +1 -1
  96. package/build/queries/text.d.ts +11 -13
  97. package/build/queries/text.js +6 -71
  98. package/build/queries/text.js.map +1 -1
  99. package/build/queries/unsafeProps.d.ts +1 -1
  100. package/build/queries/unsafeProps.js +2 -11
  101. package/build/queries/unsafeProps.js.map +1 -1
  102. package/build/queries/unsafeType.d.ts +1 -1
  103. package/build/queries/unsafeType.js +2 -9
  104. package/build/queries/unsafeType.js.map +1 -1
  105. package/build/react-versions.js +0 -4
  106. package/build/react-versions.js.map +1 -1
  107. package/build/render.d.ts +88 -141
  108. package/build/render.js +21 -31
  109. package/build/render.js.map +1 -1
  110. package/build/renderHook.d.ts +2 -2
  111. package/build/renderHook.js +2 -12
  112. package/build/renderHook.js.map +1 -1
  113. package/build/screen.js +0 -6
  114. package/build/screen.js.map +1 -1
  115. package/build/shallow.js +0 -6
  116. package/build/shallow.js.map +1 -1
  117. package/build/waitFor.d.ts +1 -1
  118. package/build/waitFor.js +29 -52
  119. package/build/waitFor.js.map +1 -1
  120. package/build/waitForElementToBeRemoved.js +2 -11
  121. package/build/waitForElementToBeRemoved.js.map +1 -1
  122. package/build/within.d.ts +84 -138
  123. package/build/within.js +2 -14
  124. package/build/within.js.map +1 -1
  125. package/package.json +12 -11
  126. package/typings/index.flow.js +169 -56
package/build/render.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import TestRenderer from 'react-test-renderer';
2
2
  import * as React from 'react';
3
- export declare type RenderOptions = {
3
+ import { DebugOptions } from './helpers/debugDeep';
4
+ export type RenderOptions = {
4
5
  wrapper?: React.ComponentType<any>;
5
6
  createNodeMock?: (element: React.ReactElement) => any;
6
7
  unstable_validateStringsRenderedWithinText?: boolean;
7
8
  };
8
- export declare type RenderResult = ReturnType<typeof render>;
9
+ export type RenderResult = ReturnType<typeof render>;
9
10
  /**
10
11
  * Renders test component deeply using react-test-renderer and exposes helpers
11
12
  * to assert on the output.
@@ -33,159 +34,105 @@ export default function render<T>(component: React.ReactElement<T>, { wrapper: W
33
34
  UNSAFE_getAllByType: <P_1>(type: React.ComponentType<P_1>) => TestRenderer.ReactTestInstance[];
34
35
  UNSAFE_queryByType: <P_2>(type: React.ComponentType<P_2>) => TestRenderer.ReactTestInstance | null;
35
36
  UNSAFE_queryAllByType: <P_3>(type: React.ComponentType<P_3>) => TestRenderer.ReactTestInstance[];
36
- getByA11yValue: import("./queries/makeQueries").GetByQuery<{
37
- min?: number | undefined;
38
- max?: number | undefined;
39
- now?: number | undefined;
40
- text?: string | undefined;
41
- }, void>;
42
- getAllByA11yValue: import("./queries/makeQueries").GetAllByQuery<{
43
- min?: number | undefined;
44
- max?: number | undefined;
45
- now?: number | undefined;
46
- text?: string | undefined;
47
- }, void>;
48
- queryByA11yValue: import("./queries/makeQueries").QueryByQuery<{
49
- min?: number | undefined;
50
- max?: number | undefined;
51
- now?: number | undefined;
52
- text?: string | undefined;
53
- }, void>;
54
- queryAllByA11yValue: import("./queries/makeQueries").QueryAllByQuery<{
55
- min?: number | undefined;
56
- max?: number | undefined;
57
- now?: number | undefined;
58
- text?: string | undefined;
59
- }, void>;
60
- findByA11yValue: import("./queries/makeQueries").FindByQuery<{
61
- min?: number | undefined;
62
- max?: number | undefined;
63
- now?: number | undefined;
64
- text?: string | undefined;
65
- }, void>;
66
- findAllByA11yValue: import("./queries/makeQueries").FindAllByQuery<{
67
- min?: number | undefined;
68
- max?: number | undefined;
69
- now?: number | undefined;
70
- text?: string | undefined;
71
- }, void>;
72
- getByAccessibilityValue: import("./queries/makeQueries").GetByQuery<{
73
- min?: number | undefined;
74
- max?: number | undefined;
75
- now?: number | undefined;
76
- text?: string | undefined;
77
- }, void>;
78
- getAllByAccessibilityValue: import("./queries/makeQueries").GetAllByQuery<{
79
- min?: number | undefined;
80
- max?: number | undefined;
81
- now?: number | undefined;
82
- text?: string | undefined;
83
- }, void>;
84
- queryByAccessibilityValue: import("./queries/makeQueries").QueryByQuery<{
85
- min?: number | undefined;
86
- max?: number | undefined;
87
- now?: number | undefined;
88
- text?: string | undefined;
89
- }, void>;
90
- queryAllByAccessibilityValue: import("./queries/makeQueries").QueryAllByQuery<{
91
- min?: number | undefined;
92
- max?: number | undefined;
93
- now?: number | undefined;
94
- text?: string | undefined;
95
- }, void>;
96
- findByAccessibilityValue: import("./queries/makeQueries").FindByQuery<{
97
- min?: number | undefined;
98
- max?: number | undefined;
99
- now?: number | undefined;
100
- text?: string | undefined;
101
- }, void>;
102
- findAllByAccessibilityValue: import("./queries/makeQueries").FindAllByQuery<{
103
- min?: number | undefined;
104
- max?: number | undefined;
105
- now?: number | undefined;
106
- text?: string | undefined;
107
- }, void>;
108
- getByA11yState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, void>;
109
- getAllByA11yState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, void>;
110
- queryByA11yState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, void>;
111
- queryAllByA11yState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, void>;
112
- findByA11yState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, void>;
113
- findAllByA11yState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, void>;
114
- getByAccessibilityState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, void>;
115
- getAllByAccessibilityState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, void>;
116
- queryByAccessibilityState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, void>;
117
- queryAllByAccessibilityState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, void>;
118
- findByAccessibilityState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, void>;
119
- findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, void>;
120
- getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, {
37
+ getByA11yValue: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
38
+ getAllByA11yValue: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
39
+ queryByA11yValue: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
40
+ queryAllByA11yValue: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
41
+ findByA11yValue: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
42
+ findAllByA11yValue: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
43
+ getByAccessibilityValue: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
44
+ getAllByAccessibilityValue: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
45
+ queryByAccessibilityValue: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
46
+ queryAllByAccessibilityValue: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
47
+ findByAccessibilityValue: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
48
+ findAllByAccessibilityValue: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
49
+ getByA11yState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
50
+ getAllByA11yState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
51
+ queryByA11yState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
52
+ queryAllByA11yState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
53
+ findByA11yState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
54
+ findAllByA11yState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
55
+ getByAccessibilityState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
56
+ getAllByAccessibilityState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
57
+ queryByAccessibilityState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
58
+ queryAllByAccessibilityState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
59
+ findByAccessibilityState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
60
+ findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, import("./queries/options").CommonQueryOptions>;
61
+ getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
121
62
  name?: import("./matches").TextMatch | undefined;
63
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
122
64
  }>;
123
- getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, {
65
+ getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
124
66
  name?: import("./matches").TextMatch | undefined;
67
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
125
68
  }>;
126
- queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, {
69
+ queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
127
70
  name?: import("./matches").TextMatch | undefined;
71
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
128
72
  }>;
129
- queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, {
73
+ queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
130
74
  name?: import("./matches").TextMatch | undefined;
75
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
131
76
  }>;
132
- findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, {
77
+ findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
133
78
  name?: import("./matches").TextMatch | undefined;
79
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
134
80
  }>;
135
- findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, {
81
+ findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("react-native").AccessibilityState & {
136
82
  name?: import("./matches").TextMatch | undefined;
83
+ value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
137
84
  }>;
138
- getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
139
- getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
140
- queryByHintText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
141
- queryAllByHintText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
142
- findByHintText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
143
- findAllByHintText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
144
- getByA11yHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
145
- getAllByA11yHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
146
- queryByA11yHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
147
- queryAllByA11yHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
148
- findByA11yHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
149
- findAllByA11yHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
150
- getByAccessibilityHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
151
- getAllByAccessibilityHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
152
- queryByAccessibilityHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
153
- queryAllByAccessibilityHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
154
- findByAccessibilityHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
155
- findAllByAccessibilityHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
156
- getByLabelText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
157
- getAllByLabelText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
158
- queryByLabelText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
159
- queryAllByLabelText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
160
- findByLabelText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
161
- findAllByLabelText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
162
- getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
163
- getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
164
- queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
165
- queryAllByPlaceholderText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
166
- findByPlaceholderText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
167
- findAllByPlaceholderText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
168
- getByDisplayValue: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
169
- getAllByDisplayValue: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
170
- queryByDisplayValue: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
171
- queryAllByDisplayValue: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
172
- findByDisplayValue: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
173
- findAllByDisplayValue: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
174
- getByTestId: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
175
- getAllByTestId: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
176
- queryByTestId: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
177
- queryAllByTestId: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
178
- findByTestId: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
179
- findAllByTestId: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
180
- getByText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
181
- getAllByText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
182
- queryByText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
183
- queryAllByText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
184
- findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
185
- findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
85
+ getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
86
+ getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
87
+ queryByHintText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
88
+ queryAllByHintText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
89
+ findByHintText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
90
+ findAllByHintText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
91
+ getByA11yHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
92
+ getAllByA11yHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
93
+ queryByA11yHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
94
+ queryAllByA11yHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
95
+ findByA11yHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
96
+ findAllByA11yHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
97
+ getByAccessibilityHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
98
+ getAllByAccessibilityHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
99
+ queryByAccessibilityHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
100
+ queryAllByAccessibilityHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
101
+ findByAccessibilityHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
102
+ findAllByAccessibilityHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
103
+ getByLabelText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
104
+ getAllByLabelText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
105
+ queryByLabelText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
106
+ queryAllByLabelText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
107
+ findByLabelText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
108
+ findAllByLabelText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
109
+ getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
110
+ getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
111
+ queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
112
+ queryAllByPlaceholderText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
113
+ findByPlaceholderText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
114
+ findAllByPlaceholderText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
115
+ getByDisplayValue: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
116
+ getAllByDisplayValue: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
117
+ queryByDisplayValue: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
118
+ queryAllByDisplayValue: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
119
+ findByDisplayValue: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
120
+ findAllByDisplayValue: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
121
+ getByTestId: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
122
+ getAllByTestId: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
123
+ queryByTestId: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
124
+ queryAllByTestId: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
125
+ findByTestId: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
126
+ findAllByTestId: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
127
+ getByText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
128
+ getAllByText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
129
+ queryByText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
130
+ queryAllByText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
131
+ findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
132
+ findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
186
133
  };
187
134
  interface DebugFunction {
188
- (message?: string): void;
135
+ (options?: DebugOptions | string): void;
189
136
  shallow: (message?: string) => void;
190
137
  }
191
138
  export {};
package/build/render.js CHANGED
@@ -4,31 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = render;
7
-
8
7
  var _reactTestRenderer = _interopRequireDefault(require("react-test-renderer"));
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _act = _interopRequireDefault(require("./act"));
13
-
14
10
  var _cleanup = require("./cleanup");
15
-
16
11
  var _debugShallow = _interopRequireDefault(require("./helpers/debugShallow"));
17
-
18
12
  var _debugDeep = _interopRequireDefault(require("./helpers/debugDeep"));
19
-
20
13
  var _within = require("./within");
21
-
22
14
  var _screen = require("./screen");
23
-
24
15
  var _stringValidation = require("./helpers/stringValidation");
25
-
16
+ var _config = require("./config");
26
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
20
  /**
33
21
  * Renders test component deeply using react-test-renderer and exposes helpers
34
22
  * to assert on the output.
@@ -44,15 +32,12 @@ function render(component, {
44
32
  createNodeMock
45
33
  });
46
34
  }
47
-
48
35
  const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
49
-
50
36
  const renderer = renderWithAct(wrap(component), createNodeMock ? {
51
37
  createNodeMock
52
38
  } : undefined);
53
39
  return buildRenderResult(renderer, wrap);
54
40
  }
55
-
56
41
  function renderWithStringValidation(component, {
57
42
  wrapper: Wrapper,
58
43
  createNodeMock
@@ -62,31 +47,27 @@ function renderWithStringValidation(component, {
62
47
  (0, _stringValidation.validateStringsRenderedWithinText)(_screen.screen.toJSON());
63
48
  }
64
49
  };
65
-
66
50
  const wrap = element => /*#__PURE__*/React.createElement(React.Profiler, {
67
51
  id: "renderProfiler",
68
52
  onRender: handleRender
69
53
  }, Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element);
70
-
71
54
  const renderer = renderWithAct(wrap(component), createNodeMock ? {
72
55
  createNodeMock
73
56
  } : undefined);
74
57
  (0, _stringValidation.validateStringsRenderedWithinText)(renderer.toJSON());
75
58
  return buildRenderResult(renderer, wrap);
76
59
  }
77
-
78
60
  function buildRenderResult(renderer, wrap) {
79
61
  const update = updateWithAct(renderer, wrap);
80
62
  const instance = renderer.root;
81
-
82
63
  const unmount = () => {
83
64
  (0, _act.default)(() => {
84
65
  renderer.unmount();
85
66
  });
86
67
  };
87
-
88
68
  (0, _cleanup.addToCleanupQueue)(unmount);
89
- const result = { ...(0, _within.getQueriesForElement)(instance),
69
+ const result = {
70
+ ...(0, _within.getQueriesForElement)(instance),
90
71
  update,
91
72
  unmount,
92
73
  container: instance,
@@ -98,16 +79,15 @@ function buildRenderResult(renderer, wrap) {
98
79
  (0, _screen.setRenderResult)(result);
99
80
  return result;
100
81
  }
101
-
102
82
  function renderWithAct(component, options) {
103
83
  let renderer;
104
84
  (0, _act.default)(() => {
105
85
  renderer = _reactTestRenderer.default.create(component, options);
106
- }); // @ts-ignore act is sync, so renderer is always initialised here
86
+ });
107
87
 
88
+ // @ts-ignore act is sync, so renderer is always initialised here
108
89
  return renderer;
109
90
  }
110
-
111
91
  function updateWithAct(renderer, wrap) {
112
92
  return function (component) {
113
93
  (0, _act.default)(() => {
@@ -115,18 +95,28 @@ function updateWithAct(renderer, wrap) {
115
95
  });
116
96
  };
117
97
  }
118
-
119
98
  function debug(instance, renderer) {
120
- function debugImpl(message) {
99
+ function debugImpl(options) {
100
+ const {
101
+ defaultDebugOptions
102
+ } = (0, _config.getConfig)();
103
+ const debugOptions = typeof options === 'string' ? {
104
+ ...defaultDebugOptions,
105
+ message: options
106
+ } : {
107
+ ...defaultDebugOptions,
108
+ ...options
109
+ };
110
+ if (typeof options === 'string') {
111
+ // eslint-disable-next-line no-console
112
+ console.warn('Using debug("message") is deprecated and will be removed in future release, please use debug({ message; "message" }) instead.');
113
+ }
121
114
  const json = renderer.toJSON();
122
-
123
115
  if (json) {
124
- return (0, _debugDeep.default)(json, message);
116
+ return (0, _debugDeep.default)(json, debugOptions);
125
117
  }
126
118
  }
127
-
128
119
  debugImpl.shallow = message => (0, _debugShallow.default)(instance, message);
129
-
130
120
  return debugImpl;
131
121
  }
132
122
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["render","component","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","renderWithStringValidation","wrap","element","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","container","rerender","debug","setRenderResult","options","TestRenderer","create","debugImpl","message","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import TestRenderer from 'react-test-renderer';\nimport type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport debugShallow from './helpers/debugShallow';\nimport debugDeep from './helpers/debugDeep';\nimport { getQueriesForElement } from './within';\nimport { setRenderResult, screen } from './screen';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\n\nexport type RenderOptions = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\n};\n\ntype TestRendererOptions = {\n createNodeMock: (element: React.ReactElement) => any;\n};\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n }: RenderOptions = {}\n) {\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n container: instance,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n };\n\n setRenderResult(result);\n return result;\n}\n\nfunction renderWithAct(\n component: React.ReactElement,\n options?: TestRendererOptions\n): ReactTestRenderer {\n let renderer: ReactTestRenderer;\n\n act(() => {\n renderer = TestRenderer.create(component, options);\n });\n\n // @ts-ignore act is sync, so renderer is always initialised here\n return renderer;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (message?: string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(message?: string) {\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, message);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"render.js","names":["render","component","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","renderWithStringValidation","wrap","element","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","container","rerender","debug","setRenderResult","options","TestRenderer","create","debugImpl","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import TestRenderer from 'react-test-renderer';\nimport type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport debugShallow from './helpers/debugShallow';\nimport debugDeep, { DebugOptions } from './helpers/debugDeep';\nimport { getQueriesForElement } from './within';\nimport { setRenderResult, screen } from './screen';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\nimport { getConfig } from './config';\n\nexport type RenderOptions = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\n};\n\ntype TestRendererOptions = {\n createNodeMock: (element: React.ReactElement) => any;\n};\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n }: RenderOptions = {}\n) {\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n container: instance,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n };\n\n setRenderResult(result);\n return result;\n}\n\nfunction renderWithAct(\n component: React.ReactElement,\n options?: TestRendererOptions\n): ReactTestRenderer {\n let renderer: ReactTestRenderer;\n\n act(() => {\n renderer = TestRenderer.create(component, options);\n });\n\n // @ts-ignore act is sync, so renderer is always initialised here\n return renderer;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (options?: DebugOptions | string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(options?: DebugOptions | string) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions =\n typeof options === 'string'\n ? { ...defaultDebugOptions, message: options }\n : { ...defaultDebugOptions, ...options };\n\n if (typeof options === 'string') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Using debug(\"message\") is deprecated and will be removed in future release, please use debug({ message; \"message\" }) instead.'\n );\n }\n\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, debugOptions);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":"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"}
@@ -1,12 +1,12 @@
1
1
  import type { ComponentType } from 'react';
2
- export declare type RenderHookResult<Result, Props> = {
2
+ export type RenderHookResult<Result, Props> = {
3
3
  rerender: (props: Props) => void;
4
4
  result: {
5
5
  current: Result;
6
6
  };
7
7
  unmount: () => void;
8
8
  };
9
- export declare type RenderHookOptions<Props> = Props extends object | string | number | boolean ? {
9
+ export type RenderHookOptions<Props> = Props extends object | string | number | boolean ? {
10
10
  initialProps: Props;
11
11
  wrapper?: ComponentType<any>;
12
12
  } : {
@@ -4,31 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.renderHook = renderHook;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _render = _interopRequireDefault(require("./render"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function renderHook(renderCallback, options) {
15
11
  const initialProps = options?.initialProps;
16
12
  const wrapper = options?.wrapper;
17
-
18
13
  const result = /*#__PURE__*/_react.default.createRef();
19
-
20
14
  function TestComponent({
21
15
  renderCallbackProps
22
16
  }) {
23
17
  const renderResult = renderCallback(renderCallbackProps);
24
-
25
18
  _react.default.useEffect(() => {
26
19
  result.current = renderResult;
27
20
  });
28
-
29
21
  return null;
30
22
  }
31
-
32
23
  const {
33
24
  rerender: baseRerender,
34
25
  unmount
@@ -40,14 +31,13 @@ function renderHook(renderCallback, options) {
40
31
  }), {
41
32
  wrapper
42
33
  });
43
-
44
34
  function rerender(rerenderCallbackProps) {
45
35
  return baseRerender( /*#__PURE__*/_react.default.createElement(TestComponent, {
46
36
  renderCallbackProps: rerenderCallbackProps
47
37
  }));
48
- } // @ts-expect-error result is ill typed because ref is initialized to null
49
-
38
+ }
50
39
 
40
+ // @ts-expect-error result is ill typed because ref is initialized to null
51
41
  return {
52
42
  result,
53
43
  rerender,
@@ -1 +1 @@
1
- {"version":3,"file":"renderHook.js","names":["renderHook","renderCallback","options","initialProps","wrapper","result","React","createRef","TestComponent","renderCallbackProps","renderResult","useEffect","current","rerender","baseRerender","unmount","render","rerenderCallbackProps"],"sources":["../src/renderHook.tsx"],"sourcesContent":["import React from 'react';\nimport type { ComponentType } from 'react';\nimport render from './render';\n\nexport type RenderHookResult<Result, Props> = {\n rerender: (props: Props) => void;\n result: { current: Result };\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = Props extends\n | object\n | string\n | number\n | boolean\n ? {\n initialProps: Props;\n wrapper?: ComponentType<any>;\n }\n : { wrapper?: ComponentType<any>; initialProps?: never } | undefined;\n\nexport function renderHook<Result, Props>(\n renderCallback: (props: Props) => Result,\n options?: RenderHookOptions<Props>\n): RenderHookResult<Result, Props> {\n const initialProps = options?.initialProps;\n const wrapper = options?.wrapper;\n\n const result: React.MutableRefObject<Result | null> = React.createRef();\n\n function TestComponent({\n renderCallbackProps,\n }: {\n renderCallbackProps: Props;\n }) {\n const renderResult = renderCallback(renderCallbackProps);\n\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { rerender: baseRerender, unmount } = render(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <TestComponent renderCallbackProps={initialProps} />,\n { wrapper }\n );\n\n function rerender(rerenderCallbackProps: Props) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />\n );\n }\n\n // @ts-expect-error result is ill typed because ref is initialized to null\n return { result, rerender, unmount };\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAmBO,SAASA,UAAT,CACLC,cADK,EAELC,OAFK,EAG4B;EACjC,MAAMC,YAAY,GAAGD,OAAO,EAAEC,YAA9B;EACA,MAAMC,OAAO,GAAGF,OAAO,EAAEE,OAAzB;;EAEA,MAAMC,MAA6C,gBAAGC,cAAA,CAAMC,SAAN,EAAtD;;EAEA,SAASC,aAAT,CAAuB;IACrBC;EADqB,CAAvB,EAIG;IACD,MAAMC,YAAY,GAAGT,cAAc,CAACQ,mBAAD,CAAnC;;IAEAH,cAAA,CAAMK,SAAN,CAAgB,MAAM;MACpBN,MAAM,CAACO,OAAP,GAAiBF,YAAjB;IACD,CAFD;;IAIA,OAAO,IAAP;EACD;;EAED,MAAM;IAAEG,QAAQ,EAAEC,YAAZ;IAA0BC;EAA1B,IAAsC,IAAAC,eAAA;EAAA;EAC1C;EACA,6BAAC,aAAD;IAAe,mBAAmB,EAAEb;EAApC,EAF0C,EAG1C;IAAEC;EAAF,CAH0C,CAA5C;;EAMA,SAASS,QAAT,CAAkBI,qBAAlB,EAAgD;IAC9C,OAAOH,YAAY,eACjB,6BAAC,aAAD;MAAe,mBAAmB,EAAEG;IAApC,EADiB,CAAnB;EAGD,CA9BgC,CAgCjC;;;EACA,OAAO;IAAEZ,MAAF;IAAUQ,QAAV;IAAoBE;EAApB,CAAP;AACD"}
1
+ {"version":3,"file":"renderHook.js","names":["renderHook","renderCallback","options","initialProps","wrapper","result","React","createRef","TestComponent","renderCallbackProps","renderResult","useEffect","current","rerender","baseRerender","unmount","render","rerenderCallbackProps"],"sources":["../src/renderHook.tsx"],"sourcesContent":["import React from 'react';\nimport type { ComponentType } from 'react';\nimport render from './render';\n\nexport type RenderHookResult<Result, Props> = {\n rerender: (props: Props) => void;\n result: { current: Result };\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = Props extends\n | object\n | string\n | number\n | boolean\n ? {\n initialProps: Props;\n wrapper?: ComponentType<any>;\n }\n : { wrapper?: ComponentType<any>; initialProps?: never } | undefined;\n\nexport function renderHook<Result, Props>(\n renderCallback: (props: Props) => Result,\n options?: RenderHookOptions<Props>\n): RenderHookResult<Result, Props> {\n const initialProps = options?.initialProps;\n const wrapper = options?.wrapper;\n\n const result: React.MutableRefObject<Result | null> = React.createRef();\n\n function TestComponent({\n renderCallbackProps,\n }: {\n renderCallbackProps: Props;\n }) {\n const renderResult = renderCallback(renderCallbackProps);\n\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { rerender: baseRerender, unmount } = render(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <TestComponent renderCallbackProps={initialProps} />,\n { wrapper }\n );\n\n function rerender(rerenderCallbackProps: Props) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />\n );\n }\n\n // @ts-expect-error result is ill typed because ref is initialized to null\n return { result, rerender, unmount };\n}\n"],"mappings":";;;;;;AAAA;AAEA;AAA8B;AAmBvB,SAASA,UAAU,CACxBC,cAAwC,EACxCC,OAAkC,EACD;EACjC,MAAMC,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,OAAO,GAAGF,OAAO,EAAEE,OAAO;EAEhC,MAAMC,MAA6C,gBAAGC,cAAK,CAACC,SAAS,EAAE;EAEvE,SAASC,aAAa,CAAC;IACrBC;EAGF,CAAC,EAAE;IACD,MAAMC,YAAY,GAAGT,cAAc,CAACQ,mBAAmB,CAAC;IAExDH,cAAK,CAACK,SAAS,CAAC,MAAM;MACpBN,MAAM,CAACO,OAAO,GAAGF,YAAY;IAC/B,CAAC,CAAC;IAEF,OAAO,IAAI;EACb;EAEA,MAAM;IAAEG,QAAQ,EAAEC,YAAY;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAM;EAAA;EAChD;EACA,6BAAC,aAAa;IAAC,mBAAmB,EAAEb;EAAa,EAAG,EACpD;IAAEC;EAAQ,CAAC,CACZ;EAED,SAASS,QAAQ,CAACI,qBAA4B,EAAE;IAC9C,OAAOH,YAAY,eACjB,6BAAC,aAAa;MAAC,mBAAmB,EAAEG;IAAsB,EAAG,CAC9D;EACH;;EAEA;EACA,OAAO;IAAEZ,MAAM;IAAEQ,QAAQ;IAAEE;EAAQ,CAAC;AACtC"}
package/build/screen.js CHANGED
@@ -7,21 +7,17 @@ exports.clearRenderResult = clearRenderResult;
7
7
  exports.screen = void 0;
8
8
  exports.setRenderResult = setRenderResult;
9
9
  const SCREEN_ERROR = '`render` method has not been called';
10
-
11
10
  const notImplemented = () => {
12
11
  throw new Error(SCREEN_ERROR);
13
12
  };
14
-
15
13
  const notImplementedDebug = () => {
16
14
  throw new Error(SCREEN_ERROR);
17
15
  };
18
-
19
16
  notImplementedDebug.shallow = notImplemented;
20
17
  const defaultScreen = {
21
18
  get container() {
22
19
  throw new Error(SCREEN_ERROR);
23
20
  },
24
-
25
21
  debug: notImplementedDebug,
26
22
  update: notImplemented,
27
23
  unmount: notImplemented,
@@ -116,11 +112,9 @@ const defaultScreen = {
116
112
  };
117
113
  let screen = defaultScreen;
118
114
  exports.screen = screen;
119
-
120
115
  function setRenderResult(output) {
121
116
  exports.screen = screen = output;
122
117
  }
123
-
124
118
  function clearRenderResult() {
125
119
  exports.screen = screen = defaultScreen;
126
120
  }