首页 前端知识 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL `vitest run --coverage` Exit status 1 ELIFECYCLE Command failed

ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL `vitest run --coverage` Exit status 1 ELIFECYCLE Command failed

2024-09-18 01:09:24 前端知识 前端哥 20 672 我要收藏

ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  web-pc@0.0.0 test:coverage: vitest run --coverage
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.
 基于 Monorepo 构建的测试工作空间,vitest 的覆盖率运行报错,报错原因解决步骤

第一步检查 vitest 的test 配置项

看你的 vite.config.ts 或者 vites.config.ts 中的 test 配置项有没有配置如下内容

 test: {
      //测试覆盖率的配置
      coverage: {
        reporter: ['text', 'json', 'html'],
        provider: 'istanbul', // or 'v8'
      }
    }

第二步:检查 package.json 中 script 配置

"scripts":{
	"test:coverage": "vitest run --coverage"
}

然后运行 pnpm test:coverage
出现如下提示:

Do you want to install @vitest/coverage-istanbul?  y/N     此时输入 y

发现报错:

 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  web-pc@0.0.0 test:coverage: `vitest run --coverage`
Exit status 43
 ELIFECYCLE  Command failed with exit code 1.

重新运行依旧报错

第三步:删除 node_module 重新安装依赖包

删除所有的 node_module 然后重新安装依赖,再次运行,问题解决,个人推断,应该是没有及时更新安装依赖包导致的。

转载请注明出处或者链接地址:https://www.qianduange.cn//article/18382.html
标签
单元测试
评论
发布的文章

关于HTML的知识

2024-09-18 23:09:36

js简单实现轮播图效果

2024-09-18 23:09:36

CSS3美化网页元素

2024-09-18 23:09:27

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!