我不知道為什么ng test運行成功,而npm run test卻失敗
package.json
{
"name": "fe-patient",
"版本": "0.0.1",
"作者": "Ionic Framework",
"主頁": "https://ionicframework.com/",
"scripts": {
"commit": "git cz",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
...
npm run test應該和ng test一樣...
我試了一下,問題仍然存在:
我試了一下,問題仍然存在。
- npm cache clean --force
- rm -rf node_modules 。
- rm -rf package-lock.json
- npm install
- npm run test
Angular 12 , npm 6.14.8, ionic 5
。uj5u.com熱心網友回復:
終于找到了根本原因......
目前我們還沒有發現任何問題。
目前我們還沒有寫任何UT(規格檔案),所以我們洗掉了所有的規格檔案。
ng test如果有0個spec檔案,將顯示成功,
npm run test如果有0個spec檔案,就會出現錯誤。
更新更好的解決方案:
在karma.conf.js中更新配置也可以:
failOnEmptyTestSuite: false,
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/319149.html
標籤:
