javascript - 如何使用 Jest 和 vue-cli 更新快照

标签 javascript vue.js jestjs snapshot vue-cli

我应该可以添加 -u运行测试时的参数,但我不知道为什么它不起作用:

npm run test ComponentName.spec.js -u
npm run test ComponentName.spec.js --updateSnapshot

但它不起作用。我的 package.json:
"scripts": {
    "test": "vue-cli-service test:unit",

我知道我可以删除快照文件,但我想弄清楚为什么该命令不起作用。

最佳答案

基于 the docs :

npm run test -- -u
我验证了这个工作。

关于javascript - 如何使用 Jest 和 vue-cli 更新快照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55965225/

相关文章:

javascript - Spectron-TypeError : app. client.getText不是函数

javascript - document.getElementById(element).innerText = 变量

javascript - jQuery 在一页中显示多个时钟

javascript - 使用javascript在div中显示时钟

vue.js - 如何在实例配置中自定义主题?

javascript - 将所有 vue 组件添加到 window 数组

javascript - 将 div 滚动到 View 中时更改(淡入/淡出)固定背景图像

javascript - 如何使用 Vue 的内置机制预取图像

node.js - 如何禁用 Jest `console.log` 标签

javascript - 用于单一导入的 Jest 模拟模块