2017-12-20 31 views
0

nuxt를 기반으로 한 프로젝트에 원래 문제가 발생했습니다. 문제를 해결하기 위해 vue-cli를 통해 새 프로젝트를 설정하고 npm을 통해 AVA를 다시 설치했지만 아무 것도 변경하지 않았습니다. 나는이 문제 (https://github.com/nuxt/nuxt.js/issues/438)를 github에서 발견했다. (Atinux 's, 3 월 25 일부터) 내 질문에 대답하는 것처럼 보이지만 언급 된 링크로 가려고하면 404가 나온다. 이슈 저자는 그가 결코 가지지 못할 것이라고 말한다. 전체 경로를 사용하는 것을 생각했지만 정확히 어떤 장소에 있는지 정확히 알지 못합니다.SyntaxError : AVA로 테스트하려고 할 때 예상치 못한 토큰 <

나는 또한 다른 구성 요소 구문을 시도했지만 AVA 설치에서 문제가 있음을 알고 있기 때문에 문제는 태그의 첫 번째 "<"기호에 있습니다. 구성 요소를 가져 오지 않고 간단하게 사용하려고 시도하지 않을 때 test.('test 2', t => t.pass()) 모든 것이 잘되고 테스트가 올바르게 통과합니다. 나는이 문제에 대한 어떤 조언을 해주셔서 매우 감사 할 것입니다!

내 HelloWorld.vue 파일 :

<template> 
    <div class="hello"> 
    <h1>{{ msg }}</h1> 
    </div> 
</template> 

<script> 
export default { 
    name: 'HelloWorld', 
    data() { 
    return { 
     msg: 'Vue app' 
    } 
    } 
} 
</script> 

내 HelloWorld.test.js 파일 :

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') 
}) 

내 package.json 파일 :

{ 
    "name": "ava-testing", 
    "version": "1.0.0", 
    "description": "lol", 
    "author": "SP", 
    "private": true, 
    "scripts": { 
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 
    "start": "npm run dev", 
    "lint": "eslint --ext .js,.vue src", 
    "build": "node build/build.js", 
    "test": "ava" 
    }, 
    "dependencies": { 
    "vue": "^2.5.2" 
    }, 
    "devDependencies": { 
    "autoprefixer": "^7.1.2", 
    "ava": "^0.24.0", 
    "babel-core": "^6.22.1", 
    "babel-eslint": "^7.1.1", 
    "babel-helper-vue-jsx-merge-props": "^2.0.3", 
    "babel-loader": "^7.1.1", 
    "babel-plugin-syntax-jsx": "^6.18.0", 
    "babel-plugin-transform-runtime": "^6.22.0", 
    "babel-plugin-transform-vue-jsx": "^3.5.0", 
    "babel-preset-env": "^1.3.2", 
    "babel-preset-stage-2": "^6.22.0", 
    "chalk": "^2.0.1", 
    "copy-webpack-plugin": "^4.0.1", 
    "css-loader": "^0.28.0", 
    "eslint": "^3.19.0", 
    "eslint-config-standard": "^10.2.1", 
    "eslint-friendly-formatter": "^3.0.0", 
    "eslint-loader": "^1.7.1", 
    "eslint-plugin-html": "^3.0.0", 
    "eslint-plugin-import": "^2.7.0", 
    "eslint-plugin-node": "^5.2.0", 
    "eslint-plugin-promise": "^3.4.0", 
    "eslint-plugin-standard": "^3.0.1", 
    "extract-text-webpack-plugin": "^3.0.0", 
    "file-loader": "^1.1.4", 
    "friendly-errors-webpack-plugin": "^1.6.1", 
    "html-webpack-plugin": "^2.30.1", 
    "node-notifier": "^5.1.2", 
    "optimize-css-assets-webpack-plugin": "^3.2.0", 
    "ora": "^1.2.0", 
    "portfinder": "^1.0.13", 
    "postcss-import": "^11.0.0", 
    "postcss-loader": "^2.0.8", 
    "rimraf": "^2.6.0", 
    "semver": "^5.3.0", 
    "shelljs": "^0.7.6", 
    "uglifyjs-webpack-plugin": "^1.1.1", 
    "url-loader": "^0.5.8", 
    "vue-loader": "^13.3.0", 
    "vue-style-loader": "^3.0.1", 
    "vue-template-compiler": "^2.5.2", 
    "webpack": "^3.6.0", 
    "webpack-bundle-analyzer": "^2.9.0", 
    "webpack-dev-server": "^2.9.1", 
    "webpack-merge": "^4.1.0" 
    }, 
    "engines": { 
    "node": ">= 4.0.0", 
    "npm": ">= 3.0.0" 
    }, 
    "browserslist": [ 
    "> 1%", 
    "last 2 versions", 
    "not ie <= 8" 
    ] 
} 

답변