Transitioning to Nx fails when current Angular repo has Cypress installed
See original GitHub issueCurrent Behavior
When I try to migrate existing Angular 13 project which has Cypress e2e tests, I see the below error
Make sure the testproject.architect.e2e.options.protractorConfig is valid or the testproject project is removed from angular.json.
An e2e project was specified but undefined could not be found.
Your workspace could not be converted into an Nx Workspace because of the above error.
An e2e project was specified but undefined could not be found.
Expected Behavior
The migration should work as expected
Steps to Reproduce
- Create new Angular project through Angular CLi
- Add Cypress to it
- Then try to migrate the project with command
ng add @nrwl/workspace
orng add @nrwl/workspace --preserveAngularCLILayout
angular.json
"e2e": {
"builder": "@cypress/schematic:cypress",
"options": {
"devServerTarget": "testproject:serve",
"watch": true,
"headless": true,
"browser": "chrome"
},
"configurations": {
"production": {
"devServerTarget": "testproject:serve:production"
}
}
},
and folder structure looks like below

Failure Logs
Make sure the testproject.architect.e2e.options.protractorConfig is valid or the testproject project is removed from angular.json.
An e2e project was specified but undefined could not be found.
Your workspace could not be converted into an Nx Workspace because of the above error.
An e2e project was specified but undefined could not be found.
Environment
> NX Report complete - copy this into the issue template
Node : 16.13.1
OS : darwin x64
npm : 8.1.2
nx : 13.1.3
@nrwl/angular : undefined
@nrwl/cli : 13.4.3
@nrwl/cypress : undefined
@nrwl/devkit : 13.1.3
@nrwl/eslint-plugin-nx : undefined
@nrwl/express : undefined
@nrwl/jest : 13.4.3
@nrwl/linter : 13.4.3
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.1.3
@nrwl/web : undefined
@nrwl/workspace : 13.4.3
@nrwl/storybook : undefined
@nrwl/gatsby : undefined
typescript : 4.5.4
rxjs : 7.4.0
---------------------------------------
Community plugins:
@angular/animations: 13.1.1
@angular/cdk: 13.1.1
@angular/common: 13.1.1
@angular/compiler: 13.1.1
@angular/core: 13.1.1
@angular/forms: 13.1.1
@angular/material: 13.1.1
@angular/platform-browser: 13.1.1
@angular/platform-browser-dynamic: 13.1.1
@angular/platform-server: 13.1.1
@angular/router: 13.1.1
@datorama/akita: 7.0.1
@angular-devkit/build-angular: 13.1.2
@angular-eslint/builder: 13.0.1
@angular-eslint/schematics: 13.0.1
@angular/cli: 13.1.2
@angular/compiler-cli: 13.1.1
@cypress/schematic: 1.6.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Migrating an Angular CLI project to Nx
This command will install the correct version of Nx based on your Angular version. This will enable you to use the Nx CLI...
Read more >Trying to run nx.dev e2e tests I get the error "Cannot find ...
As the error states, the module cypress/package.json is missing, ... it along the way in this project as it takes a while to...
Read more >nrwl-nx/community - Gitter
I'm trying to setup cypress for running e2e tests in an existing Angular app. It seams that this app has to be transformed...
Read more >@Nrwl/Community
What is a general recommendation on adding NGRX to NX Angular workspace? ... I haven't used cypress very extensively before switching to nx....
Read more >Angular CLI and Nx — Why?. In this blog post, I'll present a…
Nx CLI. Nx, on the other hand, generates an Angular workspace with the following setup: Angular Application; Jest for Unit Testing; Cypress for ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This was fixed on https://github.com/nrwl/nx/pull/9105 and it will be released in an upcoming version.
There is a workaround to this. In your
angular.json
file, remove thee2e
block of configuration and save the file. Then, run theng add @nrwl/workspace
command. It will complete the migration successfully. You can then add the e2e block back in and make any changes necessary with the newly converted project.The problem here is that none of the cypress migrations are performed and you will have to perform those manually. See the manual instructions on how to do this.