Commit eba64a4
Fix Modal Fantom test by flushing message queue (#54811)
Summary:
Test was failing in CI with following error:
```
Summary of all failing tests
FAIL packages/react-native/Libraries/Modal/__tests__/Modal-itest.js (5.619 s)
● <Modal> (hermes) › props › presentationStyle › renders a Modal with presentationStyle="pageSheet"
Exception in HostFunction: MessageQueue is not empty
at validateEmptyMessageQueue (native)
417 | require('react-native/src/private/testing/fantom/specs/NativeFantom').default;
418 |
> 419 | NativeFantom.validateEmptyMessageQueue();
| ^
420 | }
421 |
422 | function serializeError(error: Error): FailureDetail {
at validateEmptyMessageQueue (private/react-native-fantom/runtime/setup.js:419:41)
at invokeHooks (private/react-native-fantom/runtime/setup.js:286:11)
at spec (private/react-native-fantom/runtime/setup.js:336:16)
at suite (private/react-native-fantom/runtime/setup.js:390:20)
at child (private/react-native-fantom/runtime/setup.js:374:33)
at suite (private/react-native-fantom/runtime/setup.js:388:22)
at child (private/react-native-fantom/runtime/setup.js:374:33)
at suite (private/react-native-fantom/runtime/setup.js:388:22)
at child (private/react-native-fantom/runtime/setup.js:374:33)
at suite (private/react-native-fantom/runtime/setup.js:388:22)
at child (private/react-native-fantom/runtime/setup.js:374:33)
at suite (private/react-native-fantom/runtime/setup.js:388:22)
at currentContext (private/react-native-fantom/runtime/setup.js:436:20)
at anonymous (private/react-native-fantom/runtime/setup.js:470:27)
```
The Modal Fantom test was failing in CI with "MessageQueue is not empty" error. This was caused by Modal's componentDidMount subscribing to ModalEventEmitter, which schedules work in the message queue. When Fantom's afterEach hook runs validateEmptyMessageQueue(), it detects pending work and fails the test.
Added Fantom.runWorkLoop() call at the end of the test to flush any pending messages in the queue before the test completes. This follows the established pattern used throughout the Fantom test suite for handling async operations.
Changelog: [Internal] Fix Fantom test
Differential Revision: D885385951 parent 9011316 commit eba64a4
File tree
1 file changed
+27
-19
lines changed- packages/react-native/Libraries/Modal/__tests__
1 file changed
+27
-19
lines changedLines changed: 27 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | | - | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | | - | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
101 | | - | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
| |||
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
120 | | - | |
| 126 | + | |
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| |||
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
140 | | - | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| |||
156 | 162 | | |
157 | 163 | | |
158 | 164 | | |
159 | | - | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
| |||
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
174 | | - | |
| 180 | + | |
175 | 181 | | |
176 | 182 | | |
177 | 183 | | |
| |||
188 | 194 | | |
189 | 195 | | |
190 | 196 | | |
191 | | - | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
| |||
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
219 | | - | |
| 225 | + | |
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
| |||
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
241 | | - | |
| 247 | + | |
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
| |||
253 | 259 | | |
254 | 260 | | |
255 | 261 | | |
256 | | - | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
271 | 277 | | |
272 | 278 | | |
273 | 279 | | |
274 | | - | |
| 280 | + | |
275 | 281 | | |
276 | 282 | | |
277 | 283 | | |
| |||
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
| 292 | + | |
286 | 293 | | |
287 | | - | |
| 294 | + | |
288 | 295 | | |
289 | 296 | | |
290 | 297 | | |
| |||
296 | 303 | | |
297 | 304 | | |
298 | 305 | | |
299 | | - | |
| 306 | + | |
300 | 307 | | |
301 | 308 | | |
302 | 309 | | |
| |||
311 | 318 | | |
312 | 319 | | |
313 | 320 | | |
314 | | - | |
| 321 | + | |
315 | 322 | | |
316 | 323 | | |
317 | 324 | | |
| |||
332 | 339 | | |
333 | 340 | | |
334 | 341 | | |
335 | | - | |
| 342 | + | |
336 | 343 | | |
337 | 344 | | |
338 | 345 | | |
| |||
356 | 363 | | |
357 | 364 | | |
358 | 365 | | |
359 | | - | |
| 366 | + | |
| 367 | + | |
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
| |||
0 commit comments