初始化vue-cli項(xiàng)目之后,運(yùn)行npm run unit報(bào)錯(cuò),解決方法如下(親測(cè)可行)溶锭。
問(wèn)題1:?Option "mapCoverage" has been removed, as it's no longer necessary.
解決:此屬性已移除,詳細(xì)可以見(jiàn) https://jestjs.io/docs/en/configuration 官方公布的屬性,在test/unit/jest.conf.js找到并刪除該屬性
//mapCoverage:?true,
問(wèn)題2:localStorage is not available for opaque origins
?解決:在jest.config.js里,增加這兩個(gè)屬性定義
module.exports = {?
verbose:true,?
testURL:"http://localhost/",
? ...}
可參考https://stackoverflow.com/questions/51554366/jest-securityerror-localstorage-is-not-available-for-opaque-origins#