cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.19k forks source link

Angular schematic generate component testing files by default #27703

Open geromegrignon opened 1 year ago

geromegrignon commented 1 year ago

Current behavior

By answering 'No' to component testing support when adding Cypress for Angular with ng add @cypress/schematics, the schematic added still overrides the generic component schematic and creates a cy.ts test file in place of the spec.ts file.

Desired behavior

If Component Testing support is not chosen by adding Cypress, creating a new component with ng g generate should create a spec.ts file by using ng generate component schematic.

Test code to reproduce

Cypress Version

13.0.0

Node version

v18.16.1

Operating System

macOS 13.5

Debug Logs

No response

Other

No response

pgates-brownadvisory commented 1 year ago

I'm seeing this, too. Angular CLI v15.1.6, Cypress v12.10.0.

Of note (perhaps) is that I didn't have this problem when I was using Angular CLI v13.3.0.

miguelarcjr commented 9 months ago

I have the same problem.

Jhamu21 commented 5 months ago

Same problem

altso commented 5 months ago

I started having the same problem at some point in an old project and was able to "fix" it by reordering schematics in angular.json file.

Before:

  "cli": {
    "schematicCollections": [
      "@cypress/schematic",
      "@angular-eslint/schematics",
      "@schematics/angular"
    ],
    "analytics": false
  }

After:

  "cli": {
    "schematicCollections": [
      "@schematics/angular",
      "@angular-eslint/schematics",
      "@cypress/schematic"
    ],
    "analytics": false
  }
Jhamu21 commented 5 months ago

I started having the same problem at some point in an old project and was able to "fix" it by reordering schematics in angular.json file.

Before:

  "cli": {
    "schematicCollections": [
      "@cypress/schematic",
      "@angular-eslint/schematics",
      "@schematics/angular"
    ],
    "analytics": false
  }

After:

  "cli": {
    "schematicCollections": [
      "@schematics/angular",
      "@angular-eslint/schematics",
      "@cypress/schematic"
    ],
    "analytics": false
  }

Thankyou it worked!