现象:
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找到并删除该属性
找到 配置文件 并移除 该属性:
问题2:localStorage is not available for opaque origins
解决:在jest.config.js里:
新增红框处属性
jest : SecurityError: localStorage is not available for opaque origins · Issue #2304 · jsdom/jsdom · GitHubWhen I run a jest with my test cases. It shows the following error when I upgrade the package. In my test cases, there is no localStorage is used. How can I fix this problem? SecurityError: localStorage is not available for opaque origin...https://github.com/jsdom/jsdom/issues/2304
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)