原文链接:https://www.cnblogs.com/qpnets/p/10368998.html

问题1: Option “mapCoverage” has been removed, as it’s no longer necessary.
原因:此属性已移除,详细可以见 https://jestjs.io/docs/en/configuration 官方公布的属性,
解决方法:在test/unit/jest.conf.js找到并删除该属性

	snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
  	setupFiles: ['<rootDir>/test/unit/setup'],
  	// mapCoverage: true,
 	 coverageDirectory: '<rootDir>/test/unit/coverage',

问题2:localStorage is not available for opaque origins

解决:在jest.config.js里,增加这两个属性定义

module.exports = {
  verbose: true,
  testURL: "http://localhost/",
  ...
}
可参考https://stackoverflow.com/questions/51554366/jest-securityerror-localstorage-is-not-available-for-opaque-origins#
Logo

前往低代码交流专区

更多推荐