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

Adding @cypress/schematic to Angular 17 default gives: Could not find NgModule #28470

Open
ray1618 opened this issue Dec 6, 2023 · 4 comments
Labels
CT Issue related to component testing npm: @cypress/schematic @cypress/schematic package issues

Comments

@ray1618
Copy link

ray1618 commented Dec 6, 2023

Current behavior

As of Angular 17 it doesn't make use of modules anymore by default. But after running ng generate component I get the following error:
Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.

--skip-import does work, but doesn't create a standalone component. (So you miss the standalone & imports properties)

I added "@cypress/schematic" by using ng add "@cypress/schematic"

Desired behavior

--skip-import should be the default.

Test code to reproduce

install angular 17

ng add @cypress/schematic

ng g c test123

Cypress Version

13.6.0

Node version

18.14.2

Operating System

Windows 10 pro 19045.3693

Debug Logs

No response

Other

No response

@jennifer-shehane jennifer-shehane added CT Issue related to component testing npm: @cypress/schematic @cypress/schematic package issues labels Dec 6, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jun 4, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2024
@tomnar
Copy link

tomnar commented Jul 15, 2024

I just ran into the same problem with a new project. Shouldn't it be fixed, so cypress works with angular's standalone components? After all, they are the new default.

@jennifer-shehane jennifer-shehane removed the stale no activity on this issue for a long period label Jul 30, 2024
@hennihaus
Copy link

hennihaus commented Sep 7, 2024

The issue exists after migrating from modules to standalone components. As it looks like it is not anymore possible to generate a component with "ng generate component test". Even with an explicit standalone configuration on project and root level in the angular.json the error still occurs.

Here are the steps to reproduce the error:

  1. npm install -g @angular/cli@17 (You can also try it on Angular 18, dont know if it occurs also there, but the propability is high)
  2. ng new standalone-project --standalone
  3. ng add @cypress/schematic --e2e --component
  4. ng g c test

Workaround:

Generate your component with the standalone option:

  1. ng g c --standalone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing npm: @cypress/schematic @cypress/schematic package issues
Projects
None yet
Development

No branches or pull requests

5 participants