Fantom runs end 5 seconds after their last test, with "Jest did not exit one second after the test run has completed": globalTeardown never clears its shutdown timer
Mantenedores costumam responder em até 2 dias
Avaliação
- Dificuldade
- 1/5
- Tempo estimado
- Menos de uma hora
- Facilidade para iniciantes
- 85/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, node.js
- Domínio
- testing
Direção de pesquisa
Comece em private/react-native-fantom/runner/global-setup/globalTeardown.js, especialmente em stopMetroServer por volta de L36-L71: ele corre o close do Metro contra um setTimeout de SHUTDOWN_TIMEOUT_MS, mas deixa o timer pendente quando close vence. Execute o script react-native-fantom-reproducer fornecido ou yarn fantom packages/react-native/Libraries/Components/View/__tests__/View-itest.js; concluído significa que o processo termina normalmente após o resumo sem o aviso “Jest did not exit”.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
Every yarn fantom run I make, passing or failing, prints "Jest did not exit one second after the test run has completed" after its summary, and the process ends about 5 seconds after the last test. --detectOpenHandles names no handle.
The 5 seconds are SHUTDOWN_TIMEOUT_MS in Fantom's globalTeardown.js. stopMetroServer races the Metro server's close against a setTimeout of SHUTDOWN_TIMEOUT_MS and never clears that timer once the close wins (globalTeardown.js L36-L71), so the pending timer keeps Node's event loop alive for the rest of the 5 seconds.
I logged the teardown with timestamps on main: the close callback fired 1 ms after teardown started, teardown returned 16 ms later, Jest printed its notice, and the timer fired 5 s after teardown started, with the process exiting right after it. With clearTimeout on the timer once Promise.race settles, the same run exits 0.9 s after teardown starts and Jest prints no notice.
Steps to reproduce
git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer./fantom/reproduce.sh jest-does-not-exit(needs Docker). It clonesreact/react-nativeatmain, builds Fantom's tester as CI does, and runsyarn fantom packages/react-native/Libraries/Components/View/__tests__/View-itest.jswith each line of output stamped with the time it was printed, then the same with--detectOpenHandles.
The same on a checkout of main once the tester is built: yarn fantom packages/react-native/Libraries/Components/View/__tests__/View-itest.js.
Expected: Jest exits once the last test has reported.
Actual: Jest prints "Jest did not exit one second after the test run has completed", and the process exits about 4.6 s after the summary; with --detectOpenHandles it exits 4.7 s after the summary and lists no open handle.
React Native Version
0.88.0 (reproduced on main at 97f6997)
Affected Platforms
Build - Linux
Output of npx @react-native-community/cli info
System:
OS: Linux 6.18 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 116.43 GB / 125.63 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 22.14.0
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.9.2
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "37"
Build Tools:
- 37.0.0
Android NDK: 28.2.13676358
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: /usr/bin/javac
Ruby:
version: 3.0.2
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
react-native 97f6997ee347f9e406787da9c97fde687cebdda1, committed 2026-10-30T21:22:43+00:00
clang version 23.1.3 (https://github.com/llvm/llvm-project 0d261d1ca552c95a8f007e061c787ac7132fbcbc)
21:42:27.881 Test Suites: 1 passed, 1 total
21:42:27.882 Tests: 232 passed, 232 total
21:42:27.884 Snapshots: 0 total
21:42:27.885 Time: 10.674 s
21:42:27.886 Ran all test suites matching /packages\/react-native\/Libraries\/Components\/View\/__tests__\/View-itest.js/i.
21:42:28.349 Jest did not exit one second after the test run has completed.
21:42:28.351
21:42:28.352 'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
21:42:32.484 Done in 27.87s.
21:42:32.498 yarn fantom exited
21:42:32.653 $ ./scripts/fantom.sh packages/react-native/Libraries/Components/View/__tests__/View-itest.js --detectOpenHandles
21:43:15.798 Test Suites: 1 passed, 1 total
21:43:15.803 Ran all test suites matching /packages\/react-native\/Libraries\/Components\/View\/__tests__\/View-itest.js/i.
21:43:20.522 Done in 47.90s.
21:43:20.537 yarn fantom --detectOpenHandles exited
The teardown on main with a few timestamped console.log lines added (the first time is when the reproducer read the line, the second when teardown wrote it; the list of active handles is counted by type):
22:02:24.608 22:02:24.126 PROBE teardown starts
22:02:24.610 22:02:24.126 PROBE metro server true true
22:02:24.612 22:02:24.127 PROBE connections before close 1
22:02:24.614 22:02:24.127 PROBE close callback undefined
22:02:24.691 22:02:24.143 PROBE teardown ends; active handles: [12373 FSWatcher, 46 Socket, 15 ChildProcess, 11 Pipe, 1 Server]
22:02:25.147 Jest did not exit one second after the test run has completed.
22:02:29.131 22:02:29.129 PROBE shutdown timeout fired
22:02:29.189 Done in 28.88s.
22:02:29.199 yarn fantom exited
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer
Screenshots and Videos
No response
- Linguagem predominante
- C++
- Estrelas
- 127k
- Forks
- 25.4k
- Merge médio
- 2d 1h
- PRs com merge (30d)
- 67
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de react/react-native
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
react/react-native#59694 ·
Mantenedores costumam responder em até 2 dias
-
Android autolinking keeps a stale autolinking.json when only bun.lock changes, since bun.lock isn't in the default lockFilesTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
react/react-native#59693 ·
Mantenedores costumam responder em até 2 dias
-
Image.resolveAssetSource's TypeScript declaration drops the null it returns for an unknown assetTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
react/react-native#59648 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
Linking.getInitialURL() returns the task's first link after a link relaunches a reclaimed Android appTalvez já em andamento @YevheniiKotyrlo assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
react/react-native#59006 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
Fabric TextInput: prepareForRecycle leaves stale inputAccessoryViewButtonLabel (empty Done bar)Talvez já em andamento @jkasprzyk17 assumiu há 16 dias. AbertaNeeds: Author Feedback Needs: Repro
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
react/react-native#58952 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
Todas as issues de react/react-native
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
scp-fs2open/fs2open.github.com#7965 ·
Mantenedores costumam responder em até 1 dia
-
[Bug][CuTeDSL][Fuzz] `utils.gemm.sm100.epilogue` releases the accumulator before `tcgen05.ld` completes: no `tcgen05.wait::ld` before the arrive that lets the next MMA overwrite TMEMTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 4 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
elf-alchemist/elfbsp#113 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
patrick-hudson/put.gd-desktop#979 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Dao-AILab/flash-attention#3097 ·
Mantenedores costumam responder em até 3 dias