在 vue 项目中使用 jest 运行测试时出现打字稿语法错误

时间:2021-01-13 13:37:20

标签: typescript vue.js jestjs babeljs

使用 jest 运行测试用例时出现此语法错误 enter image description here

///jest.config.js
module.exports = {
  "moduleFileExtensions": [
    "js",
    "ts",
    "json",
    "vue"
  ],
  "transform": {
    ".*\\.(vue)$": "vue-jest",
    "^.+\\.tsx?$": "ts-jest"
  },
  "testURL": "http://localhost/",
  "testMatch": [
    "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
  ],
  "globals": {
    "ts-jest": {
      babelConfig: true
    }
  }
};

///babel.config.js
module.exports = {
    presets: ['@vue/app']
};

0 个答案:

没有答案