Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

The bridge's app-liveness tests decide on real time and fail intermittently

未关闭
#277 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
node.js, react-native, typescript
领域
testing

调研方向

Start with packages/bridge/src/__tests__/app-liveness.test.ts and trace how its real-time failedWithin(ms) races the liveness monitor against sleep(ms). Check how the monitor receives its clock and whether the test can control it while keeping the real bridge and WebSocket setup. Done when the liveness cases decide from the configured budgets and the intermittent timing failures are addressed.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

packages/bridge/src/__tests__/app-liveness.test.ts runs the liveness monitor on real timers with budgets tens of milliseconds apart (an idle budget of 150 ms, a file-load budget of 300 ms) and decides each case by racing the monitor's verdict against a real timer: failedWithin(ms) is Promise.race([outcome, sleep(ms)]). When the event loop runs late, a timer meant to land between two budgets lands past one of them, and a case fails although the monitor behaved as specified. On main the file fails about one run in thirty, in different cases:

FAIL  src/__tests__/app-liveness.test.ts > app liveness > gives loading a test file the file-load budget
AssertionError: expected false to be true // Object.is equality
FAIL  src/__tests__/app-liveness.test.ts > app liveness > fails a blocked JS thread after the idle budget, naming the phase
AssertionError: expected false to be true // Object.is equality

so it can fail any PR's test job. The file pairs a real bridge and client over a real WebSocket, so a clock the test controls, handed to the monitor, would let each case decide on the budgets alone.

System Info
System:
  OS: Linux 6.18 Ubuntu 24.04.5 LTS (WSL 2)
  CPU: 32 cores
Binaries:
  Node: 23.11.1
  pnpm: 10.6.1
React Native Harness Version

1.6.0 (main at 81ed195)

Reproduction

https://github.com/callstackincubator/react-native-harness/blob/main/packages/bridge/src/__tests__/app-liveness.test.ts

Steps to reproduce
  1. pnpm install, then build the packages: pnpm nx run-many -t build.
  2. In packages/bridge, run the file thirty times: for i in $(seq 30); do npx vitest run src/__tests__/app-liveness.test.ts; done. One of my thirty runs failed, in the first case above; with every core of the machine kept busy, one of ten failed, in the second.
主要语言
TypeScript
星标
335
派生
23
平均合并
1 天 8 小时
30 天内合并 PR
54

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/react-native-harness 的其他 Issue

查看 callstackincubator/react-native-harness 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。