Initially encountering an issue within the project built on nuxt, I attempted to resolve it by creating a new project using vue-cli and re-installing AVA via npm. However, this did not have any effect on the problem at hand. Upon researching, I came across an error report (https://github.com/nuxt/nuxt.js/issues/438) on github which seemed to potentially address my concern based on a comment (Atinux's, from March 25th). Unfortunately, when trying to access the provided link, I encountered a 404 error. The author of the issue mentioned using a full path, but I am unsure about the exact location he is referring to.
I also experimented with various component syntaxes, but it appears that the root cause lies in the AVA setup, specifically due to the issue with the first "<" sign from the <template>
tag. When omitting the import of my component and simply utilizing
test.('test 2', t => t.pass())
, everything works smoothly and the test runs successfully. Any guidance or suggestions on overcoming this obstacle would be greatly appreciated!
This is how my HelloWorld.vue file looks:
<template>
<div class="hello">
<h1>{{ msg }}</h1>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Vue app'
}
}
}
</script>
This is my HelloWorld.test.js file:
import test from 'ava'
import HelloWorld from './HelloWorld.vue'
test('message is Hello World', t => {
t.is(HelloWorld.name, 'HelloWorld')
})
test('message is Hello World', t => {
t.is(HelloWorld.$data.msg, 'Vue app')
})
Below is a snippet of my package.json file:
{
"name": "ava-testing",
"version": "1.0.0",
...
<shortened for brevity>
...
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}