初始化vue-cli项目之后,运行npm run unit报错,解决方法如下(亲测可行)。
问题1: Option "mapCoverage" has been removed, as it's no longer necessary.
解决:此属性已移除,详细可以见 https://jestjs.io/docs/en/configuration 官方公布的属性,在test/unit/jest.conf.js找到并删除该属性
//mapCoverage: true,
问题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#
网友评论