Angular CLI - ng e2e throws error

703 views Asked by At

I've just set up a new Angular 4 project using the Angular CLI. Just after creating it, I ran ng e2e and the sample end-to-end test executed perfectly. After this, I've added a subfolder inside the app folder called services, and generated a service inside that folder. Now, when I run ng e2e, it errors out with the following error:

[09:11:56] E/configParser - Error message: failed loading configuration file protractor.conf.js [09:11:56] E/configParser - Error: Cannot find module 'C:\Projects\new\test-project\src\app\services\protractor.conf.js

Any idea why this could be happening? I think I might need to prevent the e2e script from looking inside the services folder, but I'm not sure how to do that.

1

There are 1 answers

0
angularconsulting.au On

So sounds like you have your protractor.conf.js config file is missing on this path C:\Projects\new\test-project\src\app\services\protractor.co‌​nf.js. To restore that you can just run ng new some-app and copy it over.

To ansewer on your conmment no, you do not have to create protractor.conf.js for each folder there is just one config per app. When you generating a service or component Angular cli generating a .spec file but that is different and related to karma that is runs with ng t or ng test or npm run test.

Also, if you just starting with Angular, I would recommended to use the latest cli.