Reputation: 2875
I'm trying to setup Unit Tests with VueJS 3. Reading the docs of Vue 3, I Installed test-utils 2.0
My package.json file looks like this :
{
"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",
...
}
}
I try to run my the tests with:
npm run test:unit
But I've the following error message:
> [email protected] test:unit
> vue-cli-service test:unit
ERROR command "test:unit" does not exist.
I've a similar result with yarn
command. How can I solve this?
PS: If you need more informations, then just leave a comment :)
Upvotes: 4
Views: 2508
Reputation: 211
The @vue/test-utils does not provide the unit:test
subcommand of vue-cli-service. Those are available when using one of the following plugins:
For instructions on how to install those see: https://cli.vuejs.org/guide/plugins-and-presets.html#installing-plugins-in-an-existing-project
Upvotes: 2