请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

vite+vue3+jest搭建报错

1.报错信息
图片描述
2. package.json
{
“name”: “vite-jest”,
“version”: “0.0.0”,
“scripts”: {
“dev”: “vite”,
“build”: “vite build”,
“test”: “jest”
},
“dependencies”: {
“vue”: “^3.0.0-rc.1”
},
“devDependencies”: {
"@babel/core": “^7.11.4”,
"@babel/preset-env": “^7.11.0”,
"@types/jest": “^26.0.10”,
"@vue/compiler-sfc": “^3.0.0-rc.9”,
"@vue/test-utils": “^2.0.0-beta.3”,
“babel-jest”: “^26.3.0”,
“jest”: “^26.4.2”,
“ts-jest”: “^26.3.0”,
“typescript”: “^4.0.2”,
“vite”: “^1.0.0-rc.1”,
“vue-jest”: “^5.0.0-alpha.1”
}
}
3. jest.config.js
module.exports = {
preset: ‘ts-jest’,
clearMocks: true,
testEnvironment: ‘jsdom’,
transformIgnorePatterns: ["/node_modules/"],
transform: {
’^.+\.vueKaTeX parse error: Expected 'EOF', got '\\' at position 25: …est', '^.+\̲\̲js’: ‘babel-jest’
},
moduleFileExtensions: [‘vue’, ‘js’, ‘json’, ‘jsx’, ‘ts’, ‘tsx’, ‘node’]
}

正在回答 回答被采纳积分+3

1回答

提问者 yanchang 2020-08-31 21:56:46
测试代码
import { mount } from '@vue/test-utils'
import HelloWorld from './HelloWorld'

describe('Component', () => {
  test('is a Vue instance', () => {
    const wrapper = mount(HelloWorld)
    expect(wrapper.isVueInstance()).toBeTruthy()
  })
})


0 回复 有任何疑惑可以回复我~
  • 提问者 yanchang #1
    已解决 ts-jest版本问题
    回复 有任何疑惑可以回复我~ 2020-08-31 22:11:21
  • Dell 回复 提问者 yanchang #2
    好的!
    回复 有任何疑惑可以回复我~ 2020-09-04 23:26:03
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号