我正在尝试按照官方指南克隆演示存储库来进行单元测试vue-test-utils-getting-started
。
复制步骤
- npm install (只在克隆 vue-test-utils-getting-started 后运行一次)
- 因为文件准备好了,运行
npm test
会看到如下错误
● Validation Error:
Preset @vue/cli-plugin-unit-jest/presets/no-babel/jest-preset.js not found.
Configuration Documentation:
https://facebook.github.io/jest/docs/configuration.html
如果 cat 文件
cat @vue/cli-plugin-unit-jest/presets/no-babel/jest-preset.js
it does display the content meaning that the file does exist in the path
如果注释掉该行,它可以工作。加载预设文件的机制似乎有问题。有谁知道如何正确加载预设?
// jest.config.js
module.exports = {
// this is installed by default, but not working, many people encounters, "not found" but file exists
// preset: '@vue/cli-plugin-unit-jest/presets/no-babel'
}