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

Unit Testing an Ionic2 project issues #261

Closed nardebili closed 7 years ago

nardebili commented 7 years ago

Hi Lathonez,

I have followed your instructions in trying to integrate your approach for our Ionic project and have hit the following obstacles:

ERROR in /Users/nader/dev/ionic/sunesisApp/src/test.ts (15,37): Cannot find module './services/clickers.mock'.

ERROR in /Users/nader/dev/ionic/sunesisApp/src/test.ts (16,33): Cannot find module './services'.

ERROR in ./src/test.ts Module not found: Error: Can't resolve './services' in '/Users/nader/dev/ionic/sunesisApp/src' @ ./src/test.ts 16:17-38

ERROR in ./src/test.ts Module not found: Error: Can't resolve './services/clickers.mock' in '/Users/nader/dev/ionic/sunesisApp/src' @ ./src/test.ts 15:22-57

Actually, there was another missing module, namely ionic-mock, but I got passed that with npm install ionic-mocks.

Any advice to help me get pass these obstacles would be appreciated.

Regards,

lathonez commented 7 years ago

Hey,

Thanks - I'm missing ionic-mocks in the blog, will add it now.

If you copy the files directly from my repo, you need to remove the bits that may not be relevant to your project.

test.ts: Main entry point for our unit tests. Remove references to ClickerServices as they won’t be applicable to you

Your test.ts file is referencing files that do not exist in your project. Remove those references.

Thanks,

Stephen