依赖的版本很重要,不要出错了

devDependencies:{
  "babel-core": "^6.26.3",
  "babel-jest": "^22.4.3",
       "babel-loader": "^7.1.1",
       "babel-plugin-dynamic-import-webpack": "^1.1.0",
       "jest": "^24.9.0",
       "jest-serializer-vue": "^0.3.0",
       "jest-transform-stub": "^2.0.0",
    "vue-jest": "^3.0.5",
       "vue-loader": "^13.7.1",
},
moduleFileExtensions: [
    'js',
    'jsx',
    'json',
    'vue'
  ],
  globals: {
  },
  transform: {
    '.*\\.(vue)$': 'vue-jest',
    '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
    '^.+\\.js$': '<rootDir>/node_modules/babel-jest'
  },
  transformIgnorePatterns: [
    '/node_modules/'
  ],
  moduleNameMapper: {
    '\\.(css|styl|less|sass|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
    '^@/(.*)$': '<rootDir>/src/$1'
  },
  snapshotSerializers: [
    'jest-serializer-vue'
  ],
  testMatch: [
    '**/test/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
  ],
  testURL: 'http://localhost/',
  collectCoverage: true,
  collectCoverageFrom: [
    'src/page/**/*.{js,vue}'
  ],
  coverageDirectory: '<rootDir>/test/unit/coverage'
posted on 2019-10-28 10:35  菲比寻常  阅读(814)  评论(0编辑  收藏  举报