Skip to content

Conversation

@alanleedev
Copy link
Contributor

Summary:
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: D88538595

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 6, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 6, 2025

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88538595.

alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 9, 2025
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: D88538595
alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 9, 2025
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: D88538595
@alanleedev alanleedev force-pushed the export-D88538595 branch 2 times, most recently from 548788e to 0b2e55e Compare December 9, 2025 16:18
alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 9, 2025
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: D88538595
@alanleedev alanleedev changed the title Fix Modal Fantom test by flushing message queue Fix Modal Fantom test Dec 9, 2025
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. 
Referencing other tests, added afterEach() to call `root.destroy()` for proper cleanup after each test.

Changelog: [Internal] Fix Fantom test

Differential Revision: D88538595
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants