Following the instruction on Vue CLI docs, we can use the compiler-included Vue build adding the following code on vue.config.js
:
module.exports = {
runtimeCompiler: true
}
It works perfectly. However, when running unit tests with Jest, components that have the template
attribute are not properly compiled and I see a commented function instead (running wrapper.html()
).
I tried to declare the compiler-included Vue build in the Jest config file (as follows) but no success.
module.exports = {
moduleNameMapper: {
'vue$': 'vue/dist/vue.common.js'
}
}
Does anyone know how to properly config the compiler-included Vue build on tests for an application created with Vue CLI? Thanks!
question from:
https://stackoverflow.com/questions/65945305/how-to-use-compiler-included-vue-build-on-tests-using-jest-for-a-vue-cli-app 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…