我正在嘗試使用 VueJS 3 設定單元測驗。閱讀Vue 3 的檔案,我安裝了 test-utils 2.0
我的 package.json 檔案如下所示:
{
"name": "testsUnitVue",
"version": "0.1.0",
"private": true,
"scripts": {
...
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
...
},
"dependencies": {
...
},
"devDependencies": {
...
"@vue/test-utils": "^2.0.0-rc.21",
...
}
}
我嘗試使用以下方法運行測驗:
npm run test:unit
但我有以下錯誤訊息:
> testsUnitVue@0.1.0 test:unit
> vue-cli-service test:unit
ERROR command "test:unit" does not exist.
我對yarn命令有類似的結果。我該如何解決這個問題?
PS:如果您需要更多資訊,請發表評論:)
uj5u.com熱心網友回復:
@vue/test-utils 不提供unit:testvue-cli-service 的子命令。這些在使用以下插件之一時可用:
- https://cli.vuejs.org/core-plugins/unit-jest.html
- https://cli.vuejs.org/core-plugins/unit-mocha.html
有關如何安裝這些的說明,請參閱:https ://cli.vuejs.org/guide/plugins-and-presets.html#installing-plugins-in-an-existing-project
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/470388.html
標籤:javascript Vue.js 单元测试 npm Vuejs3
上一篇:將模塊匯入測驗檔案
