release: v0.5.0 — 覆盖率96.42%达标、lint零警告、覆盖率门禁、CI强化、发布自动化

- 覆盖率 96.42%(行):新增 59 测试共 385 个,覆盖 DOM 交互事件、对话框按钮交互、Intl/localStorage 异常路径、React 渲染生命周期
- 测试环境重构:SSR 分支用 defineProperty 真正覆盖 document/window;新增 tests/dom.test.ts、tests/setup.ts
- jest 覆盖率门禁 lines >= 95%;CI lint 改必过;新增 publish.yml(v* tag 自动发布到 Gitea registry)
- 修复:Toast.off 空数组残留、Toast.on 取消函数 this 绑定、action close:false 冒泡关闭、use() 重复注册钩子、i18n catch 引用错误
- 删除死代码 autoApplySystemTheme;lint 零警告(no-console 策略 + caughtErrorsIgnorePattern)
This commit is contained in:
tianhao
2026-08-08 15:02:51 +08:00
parent bbff631f4f
commit 1f718c4ef8
41 changed files with 1146 additions and 281 deletions
+22
View File
@@ -2,6 +2,28 @@
All notable changes to MetonaToast will be documented in this file.
## [0.5.0] - 2026-08-08
### Changed
- **覆盖率 96.42%(行)**:新增 59 个测试用例(共 385),覆盖 DOM 交互事件(click/drag/hover/animation)、confirm/prompt/action 按钮交互、Intl/localStorage 异常路径、React 渲染生命周期
- **测试环境重构**:SSR 分支测试用 `Object.defineProperty` 真正覆盖 document/windowjsdom getter 使此前赋值无效);新增 `tests/dom.test.ts`(jsdom 真实 DOM 事件驱动)、`tests/setup.ts`TextEncoder 补丁)
- **jest 覆盖率门禁**`lines >= 95%`,未达标测试即失败
### Fixed
- **`Toast.off` 空数组残留**:移除全部钩子后删除 Map key(此前空数组残留导致 `_hooks.has()` 误报 true
- **`Toast.on` 返回的取消函数 this 绑定**:改用类名引用,任意调用上下文可用
- **action 按钮 `close:false` 失效**:按钮 click 冒泡到 toast 的 closeOnClick 处理器导致总是关闭,已 stopPropagation 修复
- **`use()` 重复注册钩子**accessibility/persistence 预设的钩子注册改为防重复(先卸载旧钩子),并在插件 `uninstall` 中一并清理
- **i18n catch 引用错误**`catch {}` 中残留 `e` 引用导致的 ReferenceErrorsaveLocale/loadLocale/notifyLocaleListeners
- **删除残缺死代码**`styles.autoApplySystemTheme`(无实际效果的占位实现)
### Removed
- **lint 零警告**`no-console` 规则关闭(库的错误报告依赖 console,生产构建已由 terser `drop_console` 剥离);catch 变量通过 `caughtErrorsIgnorePattern` 豁免
### Added
- **Gitea Actions 发布自动化**`publish.yml` — 推送 `v*` tag 时自动 测试+构建+发布到 Gitea npm registry(需配置 `PACKAGES_TOKEN` secret
- **CI 强化**lint 改为必过(移除 continue-on-error);测试命令带覆盖率门禁
## [0.4.0] - 2026-08-08
### Added