0

I am here after 4 or more days of investigation about the same error. I have created a project using JHipster written in angular and I want to test it. JHipster generates by default some beginner testing code.

I follow this tutorial enter link description here to run the tests but something seems to be wrong and some errors appear.

What have I done:

Install all of the karma plugins. Install tslint, karma, jasmine, typscript I enter in the src\test\javascript\spec I use the command yarn test The error that appears is this:

ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/qu
mioterapia/quimioterapia-dialog.component.ts[31, 17]: Property 'activatedRoute'
is declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/ra
ioterapia/radioterapia-dialog.component.ts[31, 17]: Property 'activatedRoute' i
 declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/ot
o-tratamiento/otro-tratamiento-dialog.component.ts[33, 17]: Property 'activated
oute' is declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/fa
maco/farmaco-dialog.component.ts[9, 19]: 'Unidad' is declared but its value is
ever read.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! oncosup@0.0.0 lint: `tslint --project tsconfig.json -e 'node_modules/*
'`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oncosup@0.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional lo
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\67563478\AppData\Roaming\npm-cache\_logs\2018-04-11T08_51
27_128Z-debug.log
error An unexpected error occurred: "Command failed.
Exit code: 2
Command: C:\\Windows\\system32\\cmd.exe
Arguments: /d /s /c npm run lint && karma start src/test/javascript/karma.conf.
s
Directory: C:\\Users\\67563478\
ew_workspace\\onconsup
Output:
".
info If you think this is a bug, please open a bug report with the information
rovided in "C:\\Users\\67563478\
ew_workspace\\onconsup\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this com
and.

If I remove them the app doesnt work, and if I make them public or levae them without public/private the error is something else (look in tis question).enter link description here

I cannot run the tests this way, nor with karma nor with cucumber. It is the same error.

Alexander Abakumov
  • 13,617
  • 16
  • 88
  • 129

1 Answers1

0

As you can see, you have initialized in constructor, activatedRoute but its never been used anywhere.

This is why, typescript is giving you error. Remove unused things to fix the warning

ashfaq.p
  • 5,379
  • 21
  • 35
  • Yeah, true but this property is being used in other classes that import this one, cause this is how angular works.So, if I remove it I will have other errors – Coolest_Tester Apr 16 '18 at 11:40
  • 1
    If it is not getting used in this class, then remove from this class and import in the other classes which use it – ashfaq.p Apr 16 '18 at 11:42