使用命令" yo jhipster:langaugues"添加新语言后,我通过grunt测试得到以下错误。这些错误发生在bower_components上,我已经从Intellij Idea的项目中排除了这些错误。是不是我做得不对或JHister内的问题?
C:\Users\me/projects/myapp>grunt test
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:test" (wiredep) task
Running "ngconstant:dev" (ngconstant) task
Creating module yellowflowApp at src/main/webapp/scripts/app/app.constants.js...OK
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.12.35 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Windows 7 0.0.0)]: Connected on socket FPQ9_PnLvN3UNXN4CjH4 with id 99835325
PhantomJS 1.9.8 (Windows 7 0.0.0): Executed 14 of 21 SUCCESS (0 secs / 0.155 secs)
PhantomJS 1.9.8 (Windows 7 0.0.0) Directive Tests Password strength Should display the password strength bar FAILED
Error: Unexpected request: GET i18n/zh-cn/global.json
Expected GET i18n/en/global.json
at $httpBackend (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1212)
at sendReq (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:10233)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:9944
at processQueue (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14454)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14470
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15719
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15530
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1510
at C:/Users/me/projects/myapp/src/test/javascript/spec/app/account/password/password.directive.spec.js:27
PhantomJS 1.9.8 (Windows 7 0.0.0) Directive Tests Password strength Should change the first 2 points of the strength bar FAILED
Error: Unexpected request: GET i18n/zh-cn/global.json
Expected GET i18n/en/global.json
at $httpBackend (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1212)
at sendReq (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:10233)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:9944
at processQueue (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14454)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14470
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15719
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15530
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15824
at C:/Users/me/projects/myapp/src/test/javascript/spec/app/account/password/password.directive.spec.js:41
Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.4.0/$rootScope/inprog?p0=%24digest
at beginPhase (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:16073)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15510
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1510
at C:/Users/me/projects/myapp/src/test/javascript/spec/app/account/password/password.directive.spec.js:27
PhantomJS 1.9.8 (Windows 7 0.0.0) Directive Tests Password strength Should change the first 4 points of the strength bar FAILED
Error: Unexpected request: GET i18n/zh-cn/global.json
Expected GET i18n/en/global.json
at $httpBackend (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1212)
at sendReq (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:10233)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:9944
at processQueue (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14454)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14470
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15719
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15530
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15824
at C:/Users/me/projects/myapp/src/test/javascript/spec/app/account/password/password.directive.spec.js:56
Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.4.0/$rootScope/inprog?p0=%24digest
at beginPhase (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:16073)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15510
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1510
at C:/Users/me/projects/myapp/src/test/javascript/spec/app/account/password/password.directive.spec.js:27
PhantomJS 1.9.8 (Windows 7 0.0.0) Services Tests Auth should call LocalStorageService.clearAll on logout FAILED
Error: Unexpected request: GET i18n/zh-cn/global.json
Expected GET i18n/en/global.json
at $httpBackend (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1212)
at sendReq (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:10233)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:9944
at processQueue (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14454)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:14470
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15719
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15530
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1510
at C:/Users/me/projects/myapp/src/test/javascript/spec/components/auth/auth.services.spec.js:39
Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.4.0/$rootScope/inprog?p0=%24digest
at beginPhase (C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:16073)
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular/angular.js:15510
at C:/Users/me/projects/myapp/src/main/webapp/bower_components/angular-mocks/angular-mocks.js:1542
at C:/Users/me/projects/myapp/src/test/javascript/spec/components/auth/auth.services.spec.js:27
PhantomJS 1.9.8 (Windows 7 0.0.0): Executed 21 of 21 (4 FAILED) (0.282 secs / 0.256 secs)
Warning: Task "karma:unit" failed. Use --force to continue.
Aborted due to warnings.
Execution Time (2015-07-16 18:04:35 UTC)
wiredep:test 3.8s █████████████████████ 23%
karma:unit 12.6s ███████████████████████████████████████████████████████████████████ 76%
Total 16.5s
答案 0 :(得分:0)
对于jHipster的最新版本,这个问题不应该再发生了,因为现在有一个正则表达式没有考虑路径中的语言。 但是对于旧版本,如果更改了默认语言,则必须调整password.directive.spec.js和auth.services.spec.js以期望(现在不同的)默认语言。这些行类似于:
$httpBackend.expectGET('i18n/en/global.json').respond({});
(注意" / en /"在路径中,该部分应与当前默认语言匹配)。