Search code examples
javascriptvue.jsjestjssnapshotvue-cli

How to update snapshot with Jest and vue-cli


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.


Solution

  • Based on the docs:

    npm run test -- -u
    

    I verified this works.