如何使用Pug模板为测试vue组​​件设置Webpack

问题描述

我正在尝试使用官方文档https://vue-test-utils.vuejs.org/installation/使用模板lang =“ pug”为vue comoponent编写测试代码

我做错了什么?

谢谢。

错误

iMac-Dmitriy:template-project dmitriy$ npm run test

> Site@1.0.0 test /Library/WebServer/projects/template-project
> mochapack --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js

 WEBPACK  Compiling...

  [=========================] 100% (completed)

 WEBPACK  Failed to compile with 1 error(s)

Error in ./src/components/ui/Input.vue

  Module parse Failed: Unexpected token (1:0)
  You may need an appropriate loader to handle this file type,currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
  > <template lang="pug">
  |     include ../../tools/mixins.pug
  |     +b.LABEL.input(

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Site@1.0.0 test: `mochapack --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Site@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dmitriy/.npm/_logs/2020-11-04T17_10_06_692Z-debug.log

组件:

包括../../tools/mixins.pug用于插件bemto

<template lang="pug">
    include ../../tools/mixins.pug
    +b.LABEL.input(
        :class="{'error': error}"
    )
        +e.INPUT.value(
            :type="type"
            :value="value"
            :placeholder="placeholder"
            v-on:focus="$emit('focus')"
            v-on:blur="$emit('blur')"
            v-on:input="onInput"
        )
</template>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...