Repository navigation
test: clean up React trees before Vitest teardown - #84
waterbro-8 wants to merge 1 commit into
Conversation
|
@PeterGuy326 hosted verification is complete on exact head dcfb0d2: test, docker-build, Dependency review, and Scorecard pass; fork CodeQL is skipped. The current account lacks RequestReviewsByLogin permission, so I cannot add you through the reviewer picker. Please perform the independent review and merge if the one-file cleanup change is acceptable; this unblocks the final #51 close. |
|
当前账号是本 PR 作者,不能自审。Exact head |
|
作者是 waterbro-8,我不能对本 PR 做 CODEOWNER 自审,也不能合。 exact head 请独立 CODEOWNER(胡奕舟 / 李彬彬)review。若坚持同源 CodeQL 门禁,需要有 origin write 的人把 exact head 镜像到 bytefolk/doc。不是产品验收。 |
sun-970
left a comment
There was a problem hiding this comment.
Independent review of exact head. Not product验收. I am not merging.
Blocker
This PR is a fork (waterbro-8/doc). Required CodeQL is SKIPPED. Fail-closed: I cannot APPROVE while CodeQL did not run on this SHA.
The afterEach(cleanup) change in vitestSetup.ts is the right fix for Vitest-without-globals + React 19 teardown. Re-review after this SHA is on bytefolk/doc so CodeQL actually runs, or after a same-repo PR with CodeQL green.
I am not merging. Do not Close/Fixes linked issues from this comment.
|
Closing as superseded. The same-repository replacement opened at #105 carries exactly this change on exact head |
Outcome
Fixes the post-merge CI regression on current main after the Next 16 / React 19 migration.
The main push run https://github.com/bytefolk/doc/actions/runs/35496401031 completed all 350 assertions, then failed with an unhandled React commit from share-doc-button.test.tsx after the JSDOM environment had started tearing down.
Root cause
Vitest globals are disabled, so React Testing Library cannot auto-register its cleanup hook. Several component tests rely on that implicit hook. React 19 transitions can still be pending after an assertion succeeds, leaving a mounted tree to commit against a disposed JSDOM window.
Change
Register afterEach(cleanup) once in vitestSetup.ts so every rendered tree is unmounted before environment teardown. This also covers the same leak class across component tests instead of special-casing one test.
Verification
Refs #51. This PR only restores the migration's post-merge test signal; it does not close #51 until CI is green on this head.