本文介绍了使用jhipster 5.1.0进行客户端测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jhipster 5.1.0,并且当我生成一个新的Monolith应用程序(使用默认选项)并运行yarn test时,它失败,并显示以下输出:
I'm using jhipster 5.1.0 and when I generate a new monolith app [using default options] and I run yarn test , it fails with the following output :
$ yarn test yarn run v1.7.0 $ yarn run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js $ tslint --project tsconfig.json -e 'node_modules/**' No valid rules have been specified FAIL src/test/javascript/spec/app/admin/health/healthponent.spec.ts ● Test suite failed to run SecurityError: localStorage is not available for opaque origins at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15) at Array.forEach (<anonymous>) FAIL src/test/javascript/spec/app/shared/login/loginponent.spec.ts ● Test suite failed to run SecurityError: localStorage is not available for opaque origins at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15) at Array.forEach (<anonymous>) FAIL src/test/javascript/spec/app/admin/audits/auditsponent.spec.ts ● Test suite failed to run SecurityError: localStorage is not available for opaque origins at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15) at Array.forEach (<anonymous>) FAIL src/test/javascript/spec/app/account/password-reset/init/password-reset-initponent.spec.ts ... ● Test suite failed to run SecurityError: localStorage is not available for opaque origins at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15) at Array.forEach (<anonymous>) FAIL src/test/javascript/spec/app/admin/audits/audits.service.spec.ts ● Test suite failed to run SecurityError: localStorage is not available for opaque origins at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15) at Array.forEach (<anonymous>) ----------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ----------|----------|----------|----------|----------|-------------------| All files | 0 | 0 | 0 | 0 | | ----------|----------|----------|----------|----------|-------------------| Test Suites: 16 failed, 16 total Tests: 0 total Snapshots: 0 total Time: 2.353s Ran all test suites. error Command failed with exit code 1.这是一个错误还是我在本地丢失了一些东西?
is it a bug or I'm missing something locally ?
推荐答案好像是个错误.
尝试将其添加到src/test/javascript/jest.conf.js的底部:
Try to add this at the bottom of src/test/javascript/jest.conf.js:
testEnvironment: "node", testUrl: "localhost/"更多推荐
使用jhipster 5.1.0进行客户端测试失败
发布评论