I should be able to add -u
parameter when running my tests, but I can't figure out why it doesn't work:
npm run test ComponentName.spec.js -u npm run test ComponentName.spec.js --updateSnapshot
but it doesn't work. My package.json:
"scripts": { "test": "vue-cli-service test:unit",
I know I can just delete the snapshot files, but I'd like to figure out why the command doesn't work.
Based on the docs:
npm run test -- -u
I verified this works.
In vue-cli 3, your usual npm command calls vue-cli-service and not jest anymore. Vue-cli-service will call jest for you.
Either you can run :
npm run test:unit -- -u
the --
is so that the next arguments have to be passed to the subcommand.
Or
npx vue-cli-service test:unit -u
This will run the tests and upgrade the snapshots.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With