Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitioning to Nx fails when current Angular repo has Cypress installed #8383

Closed
pavankjadda opened this issue Jan 5, 2022 · 9 comments · Fixed by #9105
Closed

Transitioning to Nx fails when current Angular repo has Cypress installed #8383

pavankjadda opened this issue Jan 5, 2022 · 9 comments · Fixed by #9105
Assignees
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug

Comments

@pavankjadda
Copy link

pavankjadda commented Jan 5, 2022

Current 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

  1. Create new Angular project through Angular CLi
  2. Add Cypress to it
  3. Then try to migrate the project with command ng add @nrwl/workspace or ng 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

Screen Shot 2022-01-05 at 1 40 45 AM

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



@santosmken
Copy link

I got the same problem

@pavankjadda
Copy link
Author

@FrozenPandaz I see the fix changes merged. Is there any for me to try this?

@santosmken
Copy link

santosmken commented Jan 24, 2022

@pavankjadda I can confirm that this is now fixed however, I got an Unknown option: '--preserve-angular-clilayout' after the @nrwl/workspace@13.4.6 installation.

Using ng add and preserving your existing structure

Current Behavior

ℹ Using package manager: npm
✔ Found compatible package version: @nrwl/workspace@13.4.6.
✔ Package information loaded.

The package @nrwl/workspace@13.4.6 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
Unknown option: '--preserve-angular-clilayout'

Expected Behavior

The migration should work as expected without any error.

Steps to Reproduce

  1. ng add @nrwl/workspace --preserve-angular-clilayout

I also tried using the cmd ng add @nrwl/workspace --preserveAngularCLILayout and I got a warning and that cmd can only be used with a single application.

Current Behavior

"Your global Angular CLI version (13.1.3) is greater than your local version (13.1.2). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Skipping installation: Package already installed
Support for camel case arguments has been deprecated and will be removed in a future major version.
Use '--preserve-angular-clilayout' instead of '--preserveAngularCLILayout'.
The schematic can only be used with Angular CLI workspaces with a single application."

Expected Behavior

The migration should work as expected.

Steps to Reproduce

  1. ng add @nrwl/workspace --preserveAngularCLILayout

Converting Angular Workspace to NX Workspace

Current Behavior

ℹ Using package manager: npm
✔ Found compatible package version: @nrwl/workspace@13.4.6.
✔ Package information loaded.

The package @nrwl/workspace@13.4.6 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
Make sure the portal.architect.e2e.options.protractorConfig is valid or the portal 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 since there is no protractorConfig in the project.

Steps to Reproduce

  1. ng add @nrwl/workspace

Can you help us @FrozenPandaz? Thanks!

@pavankjadda
Copy link
Author

I still have the issue in Nx 13.5.3

@johnbwoodruff
Copy link
Contributor

Here are minimal repro steps for what is currently happening in 13.5.3:

Steps to Reproduce

  1. ng new test-nx-conversion
  2. ng add @cypress/schematics
  3. ng add @nrwl/workspace

Expected Behavior

The migration should work as expected.

Actual Behavior

The following error occurs:

Cannot find apps/test-nx-conversion-e2e/tsconfig.json

@johnbwoodruff
Copy link
Contributor

johnbwoodruff commented Jan 26, 2022

There is a workaround to this. In your angular.json file, remove the e2e block of configuration and save the file. Then, run the ng 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.

@santosmken
Copy link

Thanks @johnbwoodruff, I tried it and it works successfully. @pavankjadda You can try the steps above.

@leosvelperez
Copy link
Member

leosvelperez commented Feb 28, 2022

This was fixed on #9105 and it will be released in an upcoming version.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants