[英]npm run dev command does not work on vuejs' hackernews example
[英]'npm run test' works, but 'jest --coverage' command does not work
我有 MonoRepo 項目(使用Lerna ),它由多個包組成,其中一個是 React 應用程序。
在 React 項目包中,我使用 Jest 進行單元測試。 但是,當我在 WebStorm 控制台上運行jest --coverage
命令時,它返回以下錯誤:
zsh:找不到命令:開玩笑
奇怪的是,如果我使用npm run test
,測試會運行,並生成我的測試覆蓋率報告。 這是我的package.json
一部分:
"scripts": {
"test": "jest --coverage",
// other stuff
},
如您所見, npm run test
運行jest --coverage
,這正是我最初輸入的命令。 為什么jest
命令不能jest
工作?
您需要像這樣直接從node_modules
運行它:
./node_modules/.bin/jest --coverage
有關更多信息,請參閱https://jestjs.io/docs/en/getting-started#running-from-command-line
最直接的解決方案是全局安裝 jest:
npm i -g jest
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.