chore: 升级 vite-plus 工具链至 0.2.x 并修复 vp test jsdom 解析失败 - #173
Merged
Conversation
- 升级 vite/vite-plus 至 0.2.7、vitest 至 4.1.10,移除 @voidzero-dev/vite-plus-test 别名 - 修复 vp test 内置 vitest 无法解析项目 jsdom 导致 46 个测试文件全部 ERR_MODULE_NOT_FOUND 的问题:测试改走项目本地工具链,CI 改用 vp run test:unit - 修复工具链升级后 oxlint/tsgolint 新规则暴露的类型错误并格式化相关文件
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.
背景
vp test一直报错,46 个测试文件全部ERR_MODULE_NOT_FOUND (Cannot find package 'jsdom')。根因:全局
vpCLI(0.2.7)的vp test固定运行它自己内置的 vitest(位于全局缓存~/.cache/aube/virtual-store/,在项目目录之外)。内置 vitest 加载environment: "jsdom"时执行import('jsdom'),Node 模块解析从缓存目录向上查找,永远到不了项目的node_modules/jsdom。同时项目依赖还停留在旧工具链(vite-plus 0.1.14 时代,
vitest别名为@voidzero-dev/vite-plus-test),与 vp 0.2.x 不兼容。改动
工具链升级
pnpm-workspace.yaml:vite→@voidzero-dev/vite-plus-core@0.2.7、vite-plus→0.2.7、vitest→4.1.10(移除@voidzero-dev/vite-plus-test别名)pnpm-lock.yaml随vp install更新测试命令修复(jsdom 问题)
vp test始终使用内置 vitest(上游设计),本项目内通过项目本地工具链运行测试:package.json:test:unit→./node_modules/.bin/vp test(本地 vite-plus 0.2.7 解析到项目 vitest,jsdom 正常).github/workflows/ci.yml:vp test→vp run test:unit升级后 lint/format 修复
docs/index.vue可选链非空断言、model.ts冗余联合类型)TS2532(suggestion 测试)vp check --fix格式化相关文件(oxfmt 0.60 新规则)验证
vp check— 0 errorspnpm run test:unit— 46 文件 / 463 测试通过vp run build:packages— 构建成功