angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng test produces errors in 1.0.0-rc.4

Open ctrl-brk opened this issue 9 years ago • 11 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting

Versions.

@angular/cli: 1.0.0-rc.4 node: 7.5.0 os: win32 x64 @angular/animations: 4.0.0-rc.5 @angular/common: 4.0.0-rc.5 @angular/compiler: 4.0.0-rc.5 @angular/core: 4.0.0-rc.5 @angular/http: 4.0.0-rc.5 @angular/platform-browser: 4.0.0-rc.5 @angular/platform-browser-dynamic: 4.0.0-rc.5 @angular/forms: 4.0.0-rc.5 @angular/router: 4.0.0-rc.5 @angular/compiler-cli: 4.0.0-rc.5 @angular/platform-server: 4.0.0-rc.5 @angular/language-service: 4.0.0-rc.5 @angular/cli: 1.0.0-rc.4

Repro steps.

Just upgraded from 1.0.0-rc.2 to 1.0.0-rc.4 and ran ng test

The log given by the failure.

On previously working tests there're now errors like:

Cannot find name 'Event'.
Cannot find name 'alert'
Cannot find name 'confirm'
Property 'distinctUntilChanged' does not exist on type 'Observable<any>'

Desired functionality.

No errors ;)

Mention any other details that might be useful.

Confirmed by reverting back to 1.0.0-rc.2 - no errors. Back to 1.0.0-rc.4 - errors. (I did delete the whole node_modules folder when switching)

ctrl-brk avatar Mar 22 '17 05:03 ctrl-brk

I also get the following when I do ng -v

image

viztastic avatar Mar 22 '17 06:03 viztastic

Same issue here: `ERROR in C:/VSTS/Promethee/Frontend/src/app/notification/notif.ts (23,23): Cannot find name 'Element'.) C:/VSTS/Promethee/Frontend/src/app/notification/notif.ts (24,28): Cannot find name 'Element'.) C:/VSTS/Promethee/Frontend/src/app/notification/notif.ts (38,26): Cannot find name 'document'.) C:/VSTS/Promethee/Frontend/src/app/notification/notif.ts (46,25): Cannot find name 'Element'.)

ERROR in C:/VSTS/Promethee/Frontend/src/app/services/notification.service.ts (9,35): Cannot find name 'window'.)

ERROR in C:/VSTS/Promethee/Frontend/src/tdcmp/treeview/treeview.ts (47,9): Supplied parameters do not match any signature of call target.)

ERROR in C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (72,21): Cannot find name 'Element'.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (73,19): Cannot find name 'Element'.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (74,19): Cannot find name 'HTMLElement'.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (75,22): Cannot find name 'HTMLElement'.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (80,21): Cannot find name 'document'.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (166,11): Supplied parameters do not match any signature of call target.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (184,9): Supplied parameters do not match any signature of call target.) C:/VSTS/Promethee/Frontend/src/tdcmp/smartSearch/smartSearch.ts (312,5): Supplied parameters do not match any signature of call target.)`

mikezag avatar Mar 22 '17 08:03 mikezag

@ctrl-brk @viztastic @mikezag Is there a repo we can look at.

sumitarora avatar Mar 22 '17 20:03 sumitarora

@sumitarora, creating a repo with real tests is quite a challenge ;) But I've got it down to less errors by adding imports of all the rxjs operators app uses to the test module. Was compiling without it before. Now it only complains about 'alert' and 'Event' used by the app. Should I import anything else?

C:\Projects\Hlr\Zenith\Zenith.Web.Client>ng test -sr
22 03 2017 21:40:54.012:ERROR [karma]: Error: C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/test/shared/shared.ts (14,30): Cannot find name 'Event'.),C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/log.service.ts (22,9): Cannot find name 'alert'. Did you mean the instance member 'this.alert'?),C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/json-http.helper.ts (20,13): Cannot find name 'alert'.)
C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/json-http.helper.ts (22,13): Cannot find name 'alert'.),C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/shared.ts (126,16): Cannot find name 'confirm'.),C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/guards/pending-changes.guard.ts (17,45): Cannot find name 'confirm'.),C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/guards/role.guard.ts (19,13): Cannot find name 'alert'.)
C:/Projects/Hlr/Zenith/Zenith.Web.Client/src/app/shared/guards/role.guard.ts (42,9): Cannot find name 'alert'.)
    at Compiler.compiler.plugin (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\@angular\cli\plugins\karma-webpack-throw-error.js:10:23)
    at Compiler.applyPlugins (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:61:14)
    at Watching._done (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compiler.js:91:17)
    at onCompiled (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compiler.js:50:17)
    at C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compiler.js:480:13
    at next (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:138:11)
    at Compiler.<anonymous> (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\CachePlugin.js:62:5)
    at Compiler.applyPluginsAsyncSeries (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:142:13)
    at C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compiler.js:477:10
    at Compilation.applyPluginsAsyncSeries (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:131:46)
    at self.applyPluginsAsync.err (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compilation.js:640:19)
    at next (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:138:11)
    at Compilation.<anonymous> (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\ProgressPlugin.js:122:5)
    at Compilation.applyPluginsAsyncSeries (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:142:13)
    at self.applyPluginsAsync.err (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\webpack\lib\Compilation.js:631:11)
    at next (C:\Projects\Hlr\Zenith\Zenith.Web.Client\node_modules\tapable\lib\Tapable.js:138:11)

ctrl-brk avatar Mar 23 '17 03:03 ctrl-brk

I don't know if it's the samme issue, but upgrading from 1.0.0-rc.2 to 1.0.0-rc.4 gives me errors about tests that have never been modified since the moment they were created by Angular CLI. The error is: "Supplied parameters do not match any signature of call target.)" <- Also, there is no opening for this closing bracket in the error message. Should we all just inject the dependencies to the tests? If so, why didn't we need to do that before?

bakasmarius avatar Mar 23 '17 12:03 bakasmarius

We are getting the same error. This is probably caused by Jasmine Typings. Is there any fix around this?

@angular/cli: 1.0.0-rc.0 node: 6.9.4 os: win32 x64 @angular/common: 2.4.8 @angular/compiler: 2.4.8 @angular/core: 2.4.8 @angular/forms: 2.4.8 @angular/http: 2.4.8 @angular/platform-browser: 2.4.8 @angular/platform-browser-dynamic: 2.4.8 @angular/router: 3.4.8 @angular/cli: 1.0.0-rc.0 @angular/compiler-cli: 2.4.8

rafiwardak2003 avatar Mar 23 '17 21:03 rafiwardak2003

Generated new project using latest cli and then compared and updated all of my tsconfg files to the current format. Issue seems to be solved now.

ctrl-brk avatar Mar 28 '17 17:03 ctrl-brk

Just updated to @angular/cli 1.0.1 and everything seems to be fine except for pipes. I have a custom pipe with several dependency injections in the constructor and pipe's test throws an error when newing-up the pipe because "Supplied parameters do not match any signature of call target". I tried providing all the parameters but gave up when one of the parameters had to be angular/http service... Is this still a bug and pipe was just forgotten to fix, or should I NOT use dependency injections in pipe?

bakasmarius avatar Apr 25 '17 06:04 bakasmarius

My bad - I updated to 1.0.1 without deleting the node_modules directory first... So the bug still exists on 1.0.1. I'm not sure how to supply repro steps though since the only steps I could think of are:

  • In the middle of developing a big project, update @angular/cli to 1.0.0-rc.4.

bakasmarius avatar Apr 25 '17 12:04 bakasmarius

Closing as above.

sumitarora avatar May 15 '17 13:05 sumitarora

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.