lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

@angular/cli 1.0.0-rc.4 breaks tests #238

Closed ghost closed 7 years ago

ghost commented 7 years ago

for some reason the tests are running in node instead of the browser when upgrading to @angular/cli 1.0.0-rc.4. Do you know why this might be? I will try to do some more troubleshooting.

here are the errors that indicated to me that it was running in node.

ERROR in C:/projects/clicker/src/test.ts (76,24): Cannot find name 'document'.)

ERROR in C:/projects/clicker/src/mocks.ts (98,24): Cannot find name 'HTMLElement'.) C:/projects/clicker/src/mocks.ts (102,17): Cannot find name 'HTMLDocument'.) C:/projects/clicker/src/mocks.ts (103,12): Cannot find name 'document'.) C:/projects/clicker/src/mocks.ts (127,17): Cannot find name 'Window'.) C:/projects/clicker/src/mocks.ts (128,12): Cannot find name 'window'.) C:/projects/clicker/src/mocks.ts (144,12): Cannot find name 'document'.)

lathonez commented 7 years ago

I have seen this behaviour when re-running tests (e.g. angular/cli's partial rebuild).

Do you see this on first run?

I'd be very surprised if we have any behaviour that @angular/cli do not.

lathonez commented 7 years ago

Aside from that I'll take latest angular/cli as part of #237, so you'll need to wait for that.

ghost commented 7 years ago

that sounds great. It is on first run. After more testing I believe it is rc3 that it breaks on.

ghost commented 7 years ago

maybe the test bed configuration needs to be moved to another file and imported by the test files themselves? Just shooting ideas here.

ghost commented 7 years ago

I can confirm that it is breaking on rc3 after incrementing the versions one by one.

lathonez commented 7 years ago

closing in favour of #239