Tslint and node-modules errors

2020-04-18 06:51发布

问题:

I am having problems with running tests of angular using jasmine or cucumber or whatever framework. The app is written in angular 5 that uses typescript and generated by JHipster. The result of running tests is this and it seems to last hours and hours in cmd without any change:

C:\Users\67563478\new_workspace\onconsup123\src\test\javascript\spec>yarn test
yarn run v1.5.1
$ npm run lint && karma start src/test/javascript/karma.conf.js

> oncosup@0.0.0 lint C:\Users\67563478\new_workspace\onconsup123
> tslint --project tsconfig.json -e 'node_modules/**'



Hash: e0bdc8cc97632b01d813
Version: webpack 3.10.0
Time: 64ms
webpack: Compiled successfully.
webpack: Compiling...
Warning: The 'no-unused-variable' rule requires type information.

[at-loader] Using typescript@2.6.2 from typescript and "tsconfig.json" from C:\U
sers\67563478\new_workspace\onconsup123/tsconfig.json.
I have been having problems with properties initalized but never read before, so if I use // @ts-ignore: ignore not used error this line of code. ** or I make these properties public or I leave them without public/private I come to this point where the tests need hours to execute. After hours and hours the result is something like this which is not a normal execution.

        createViewNodes@webpack:///node_modules/@angular/core/esm5/core.js:13727
:37 <- spec/entry.ts:14016:76
        createRootView@webpack:///node_modules/@angular/core/esm5/core.js:13616:
0 <- spec/entry.ts:13905:20
        callWithDebugContext@webpack:///node_modules/@angular/core/esm5/core.js:
15041:25 <- spec/entry.ts:15330:47
        debugCreateRootView@webpack:///node_modules/@angular/core/esm5/core.js:1
4324:0 <- spec/entry.ts:14613:32
        create@webpack:///node_modules/@angular/core/esm5/core.js:11218:25 <- sp
ec/entry.ts:11507:60
        initComponent@webpack:///node_modules/@angular/core/esm5/testing.js:1142
:0 <- spec/entry.ts:21184:55
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        onInvoke@webpack:///node_modules/@angular/core/esm5/core.js:4733:0 <- sp
ec/entry.ts:5022:39
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        run@webpack:///node_modules/@angular/core/esm5/core.js:4550:47 <- spec/e
ntry.ts:4839:72
        createComponent@webpack:///node_modules/@angular/core/esm5/testing.js:11
45:0 <- spec/entry.ts:21187:61
        createComponent@webpack:///node_modules/@angular/core/esm5/testing.js:83
2:0 <- spec/entry.ts:20874:44
        webpack:///src/test/javascript/spec/app/entities/vacunas/vacunas-detail.
component.spec.ts:31:46 <- spec/entry.ts:144669:56
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/zone.js/dist/jasmine-patch.js:106:0 <- spec/entr
y.ts:153512:37
        webpack:///node_modules/@angular/core/esm5/testing.js:93:0 <- spec/entry
.ts:20135:31
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/async-test.js:49:0 <- spec
/entry.ts:152767:45
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:76:0 <- spec/entr
y.ts:153348:47
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/@angular/core/esm5/testing.js:88:0 <- spec/entry
.ts:20130:28
        webpack:///node_modules/zone.js/dist/async-test.js:38:0 <- spec/entry.ts
:152756:46
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:421:0 <- spec/en
try.ts:149878:36
        runTask@webpack:///node_modules/zone.js/dist/zone.js:188:0 <- spec/entry
.ts:149645:57
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:495:0 <- spec/en
try.ts:149952:41
        invoke@webpack:///node_modules/zone.js/dist/zone.js:484:0 <- spec/entry.
ts:149941:53
        timer@webpack:///node_modules/zone.js/dist/zone.js:2065:0 <- spec/entry.
ts:151522:34
        Error: <spyOn> : could not find an object to spy upon for find()
        Usage: spyOn(<object>, <methodName>) in C:/Users/67563478/new_workspace/
onconsup123/node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 4496)
        webpack:///src/test/javascript/spec/app/entities/vacunas/vacunas-detail.
component.spec.ts:40:22 <- spec/entry.ts:144676:22
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/zone.js/dist/jasmine-patch.js:106:0 <- spec/entr
y.ts:153512:37
        webpack:///node_modules/@angular/core/esm5/testing.js:93:0 <- spec/entry
.ts:20135:31
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/async-test.js:49:0 <- spec
/entry.ts:152767:45
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:76:0 <- spec/entr
y.ts:153348:47
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/@angular/core/esm5/testing.js:88:0 <- spec/entry
.ts:20130:28
        webpack:///node_modules/zone.js/dist/async-test.js:38:0 <- spec/entry.ts
:152756:46
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:421:0 <- spec/en
try.ts:149878:36
        runTask@webpack:///node_modules/zone.js/dist/zone.js:188:0 <- spec/entry
.ts:149645:57
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:495:0 <- spec/en
try.ts:149952:41
        invoke@webpack:///node_modules/zone.js/dist/zone.js:484:0 <- spec/entry.
ts:149941:53
        timer@webpack:///node_modules/zone.js/dist/zone.js:2065:0 <- spec/entry.
ts:151522:34
PhantomJS 2.1.1 (Windows 7.0.0): Executed 555 of 572 (53 FAILED) (0 secs / 1 min
 6.137 secs)
PhantomJS 2.1.1 (Windows 7.0.0) Component Tests Vacunas Management Detail Compon
ent OnInit Should call load all on init FAILED
        Error: StaticInjectorError(DynamicTestModule)[VacunasDetailComponent ->
SessionStorageService]:
          StaticInjectorError(Platform: core)[VacunasDetailComponent -> SessionS
torageService]:
            NullInjectorError: No provider for SessionStorageService! in spec/en
try.ts (line 1283)
        get@webpack:///node_modules/@angular/core/esm5/core.js:994:0 <- spec/ent
ry.ts:1283:92
        resolveToken@webpack:///node_modules/@angular/core/esm5/core.js:1292:0 <
- spec/entry.ts:1581:27
        tryResolveToken@webpack:///node_modules/@angular/core/esm5/core.js:1234:
0 <- spec/entry.ts:1523:28
        get@webpack:///node_modules/@angular/core/esm5/core.js:1102:0 <- spec/en
try.ts:1391:35
        resolveToken@webpack:///node_modules/@angular/core/esm5/core.js:1292:0 <
- spec/entry.ts:1581:27
        tryResolveToken@webpack:///node_modules/@angular/core/esm5/core.js:1234:
0 <- spec/entry.ts:1523:28
        get@webpack:///node_modules/@angular/core/esm5/core.js:1102:0 <- spec/en
try.ts:1391:35
        resolveNgModuleDep@webpack:///node_modules/@angular/core/esm5/core.js:10
836:0 <- spec/entry.ts:11125:28
        get@webpack:///node_modules/@angular/core/esm5/core.js:12069:0 <- spec/e
ntry.ts:12358:34
        resolveDep@webpack:///node_modules/@angular/core/esm5/core.js:12559:0 <-
 spec/entry.ts:12848:48
        createClass@webpack:///node_modules/@angular/core/esm5/core.js:12429:0 <
- spec/entry.ts:12718:42
        createDirectiveInstance@webpack:///node_modules/@angular/core/esm5/core.
js:12266:21 <- spec/entry.ts:12555:48
        createViewNodes@webpack:///node_modules/@angular/core/esm5/core.js:13727
:37 <- spec/entry.ts:14016:76
        createRootView@webpack:///node_modules/@angular/core/esm5/core.js:13616:
0 <- spec/entry.ts:13905:20
        callWithDebugContext@webpack:///node_modules/@angular/core/esm5/core.js:
15041:25 <- spec/entry.ts:15330:47
        debugCreateRootView@webpack:///node_modules/@angular/core/esm5/core.js:1
4324:0 <- spec/entry.ts:14613:32
        create@webpack:///node_modules/@angular/core/esm5/core.js:11218:25 <- sp
ec/entry.ts:11507:60
        initComponent@webpack:///node_modules/@angular/core/esm5/testing.js:1142
:0 <- spec/entry.ts:21184:55
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        onInvoke@webpack:///node_modules/@angular/core/esm5/core.js:4733:0 <- sp
ec/entry.ts:5022:39
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        run@webpack:///node_modules/@angular/core/esm5/core.js:4550:47 <- spec/e
ntry.ts:4839:72
        createComponent@webpack:///node_modules/@angular/core/esm5/testing.js:11
45:0 <- spec/entry.ts:21187:61
        createComponent@webpack:///node_modules/@angular/core/esm5/testing.js:83
2:0 <- spec/entry.ts:20874:44
        webpack:///src/test/javascript/spec/app/entities/vacunas/vacunas-detail.
component.spec.ts:31:46 <- spec/entry.ts:144669:56
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/zone.js/dist/jasmine-patch.js:106:0 <- spec/entr
y.ts:153512:37
        webpack:///node_modules/@angular/core/esm5/testing.js:93:0 <- spec/entry
.ts:20135:31
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/async-test.js:49:0 <- spec
/entry.ts:152767:45
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:76:0 <- spec/entr
y.ts:153348:47
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/@angular/core/esm5/testing.js:88:0 <- spec/entry
.ts:20130:28
        webpack:///node_modules/zone.js/dist/async-test.js:38:0 <- spec/entry.ts
:152756:46
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:421:0 <- spec/en
try.ts:149878:36
        runTask@webpack:///node_modules/zone.js/dist/zone.js:188:0 <- spec/entry
.ts:149645:57
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:495:0 <- spec/en
try.ts:149952:41
        invoke@webpack:///node_modules/zone.js/dist/zone.js:484:0 <- spec/entry.
ts:149941:53
        timer@webpack:///node_modules/zone.js/dist/zone.js:2065:0 <- spec/entry.
ts:151522:34
        Error: <spyOn> : could not find an object to spy upon for find()
        Usage: spyOn(<object>, <methodName>) in C:/Users/67563478/new_workspace/
onconsup123/node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 4496)
        webpack:///src/test/javascript/spec/app/entities/vacunas/vacunas-detail.
component.spec.ts:40:22 <- spec/entry.ts:144676:22
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:79:0 <- spec/entr
y.ts:153351:45
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/zone.js/dist/jasmine-patch.js:106:0 <- spec/entr
y.ts:153512:37
        webpack:///node_modules/@angular/core/esm5/testing.js:93:0 <- spec/entry
.ts:20135:31
        invoke@webpack:///node_modules/zone.js/dist/zone.js:388:0 <- spec/entry.
ts:149845:31
        onInvoke@webpack:///node_modules/zone.js/dist/async-test.js:49:0 <- spec
/entry.ts:152767:45
        onInvoke@webpack:///node_modules/zone.js/dist/proxy.js:76:0 <- spec/entr
y.ts:153348:47
        invoke@webpack:///node_modules/zone.js/dist/zone.js:387:0 <- spec/entry.
ts:149844:40
        run@webpack:///node_modules/zone.js/dist/zone.js:138:0 <- spec/entry.ts:
149595:49
        webpack:///node_modules/@angular/core/esm5/testing.js:88:0 <- spec/entry
.ts:20130:28
        webpack:///node_modules/zone.js/dist/async-test.js:38:0 <- spec/entry.ts
:152756:46
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:421:0 <- spec/en
try.ts:149878:36
        runTask@webpack:///node_modules/zone.js/dist/zone.js:188:0 <- spec/entry
.ts:149645:57
        invokeTask@webpack:///node_modules/zone.js/dist/zone.js:495:0 <- spec/en
try.ts:149952:41
        invoke@webpack:///node_modules/zone.js/dist/zone.js:484:0 <- spec/entry.
ts:149941:53
        timer@webpack:///node_modules/zone.js/dist/zone.js:2065:0 <- spec/entry.
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 556 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 557 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 558 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 559 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 560 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 561 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 562 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 563 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 564 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 565 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 566 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 567 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 568 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 569 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 570 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 571 of 572 (53 FAILED) (0 secs / 1 mi
 PhantomJS 2.1.1 (Windows 7.0.0): Executed 572 of 572 (53 FAILED) (0 secs / 1 mi
n 7.945 secs)

PhantomJS 2.1.1 (Windows 7.0.0): Executed 572 of 572 (53 FAILED) (1 min 14.4 sec
PhantomJS 2.1.1 (Windows 7.0.0): Executed 572 of 572 (53 FAILED) (1 min 14.4 sec
s / 1 min 7.945 secs)

=============================== Coverage summary ===============================

Statements   : 64.5% ( 13020/20185 )
Branches     : 26.04% ( 431/1655 )
Functions    : 37.5% ( 2198/5861 )
Lines        : 62.52% ( 11643/18624 )
================================================================================

23 04 2018 19:42:49.305:WARN [launcher]: PhantomJS was not killed in 2000 ms, se
nding SIGKILL.
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: C:\\Windows\\system32\\cmd.exe
Arguments: /d /s /c npm run lint && karma start src/test/javascript/karma.conf.j
s
Directory: C:\\Users\\67563478\
ew_workspace\\onconsup123
Output:
".
info If you think this is a bug, please open a bug report with the information p
rovided in "C:\\Users\\67563478\
ew_workspace\\onconsup123\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.

Is it supposed to be so difficult and complicated testing of angular because of typescript??** The weird part is that there appear no errors in execution and run of the application, but only when I run teh tests. The developing team is going so far, meanwhile the tester (me) cannot even run a test.

I somebody has any idea or experience about how to resolve this kind of errors I would apreciate.