✅ 添加 CustomEventMessage relatedTarget 生命周期测试 - #1685
Open
cyfung1031 wants to merge 4 commits into
Open
Conversation
cyfung1031
marked this pull request as ready for review
August 21, 2026 23:38
cyfung1031
marked this pull request as draft
August 21, 2026 23:46
cyfung1031
marked this pull request as ready for review
August 22, 2026 00:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
背景
为
CustomEventMessage.relatedTarget的生命周期和消息方向隔离补充约束测试,并修复跨实例目标引用未按消息实例归属的问题,同时改善 Vitest CI 中预期错误和真正失败之间的可读性。本次改动
CustomEventMessage实例的 Map。Map.prototype影响消息传递。GM_addStyle、GM_addElement的 parent 与无 parent 路径,确认输入 parent 和返回 element 都被消费。--silent=passed-only,保留失败测试上下文并隐藏通过测试产生的预期日志。已知限制
本次修复只覆盖
CustomEventMessage的 relatedTarget 生命周期和 CI 日志呈现,不改变其他消息传输语义。建议审查重点
getAndDelRelatedTarget是否在消费后释放引用,并对重复/未知 ID 保持安全。验证
pnpm exec vitest run packages/message src/app/service/content/gm_api --silent=passed-only --reporter=default— 10 个测试文件、143 个测试全部通过。pnpm exec vitest run packages/message/custom_event_message.test.ts packages/message/server.test.ts packages/message/message_queue.test.ts --silent=passed-only --reporter=default— 3 个测试文件、42 个测试全部通过。pnpm exec vitest run packages/message/custom_event_message.test.ts src/app/service/content/gm_api/related_target_lifecycle.test.ts --silent=passed-only --reporter=default— 2 个测试文件、8 个测试全部通过。pnpm run typecheck— 通过。git diff --check— 通过。