skylock / cypress-angular-coverage-example

31 stars 7 forks source link

Cannot use different cypress configuration file #12

Closed bindea-mihai closed 4 years ago

bindea-mihai commented 4 years ago

Hi, I'm currently trying to add code coverage into an angular application. Followed all the instructions and all seems to work fine if I explicitly open cypress using this script in package.json "cypress:open": "cypress open --config-file cypress-config/cypress.local.json". Report gets generated and all is fine.

As it's stated in the documentation this example removes protractor and adds cypress instead. This means that I should successfully use the ng e2e command to run the tests. My issue is that I'm using a different configuration file for cypress, not the default one cypress.json that sits in the root of the project and because of that when trying to run ng e2e this doesn't load the correct configurations. Also when using ng e2e it doesn't load the custom commands that I defined in cypress.

Any idea how to fix these two issues:

  1. get ng e2e to load the correct cypress configuration file
  2. why cypress doesn't find my custom commands
skylock commented 4 years ago
  1. You can have a look into how guys from https://nx.dev/latest/angular/plugins/overview are making cypress to work with angular
  2. That is an IDE and typescript related issue.