article声明Vue.js single file components can’t be compiled by ava on the fly, we have to create a setup.js file
时,所述文件如下:
// test/setup.js
const hooks = require('require-extension-hooks');
// Set up a virtual browser environment.
require('jsdom-global')();
// Setup `.vue` files to be processed by `require-extension-hooks-vue`.
hooks('vue').plugin('vue').push();
// Setup `.vue` and `.js` files to be processed by `require-extension-hooks-babel`.
hooks(['vue', 'js']).plugin('babel', { plugins: ['transform-object-rest-spread'] }).push();
但是当我运行运行Ava测试套件的npm run test
脚本时,出现以下错误:
ERROR编译失败,出现9个错误
./.nuxt/components/nuxt-error.vue中的错误
模块构建失败:TypeError:超级表达式必须为null或>函数
与前面提到的安装文件链接,我该如何即时编译Vue组件并能够使用Ava对其进行测试?请注意,我的项目遵循Nuxt结构。