question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Angular CT Schematic

See original GitHub issue

What would you like?

Part 1

It would be great for users of Angular Component Testing to be able to use the angular CLI to generate component tests for them. We do something similar with the Cypress Angular Schematic for e2e:

ng generate @cypress/schematic:e2e

I would like to propose the same functionality but for component testing:

ng generate @cypress/schematic:ct button

This would essentially generate a file named button.component.cy.ts that looks like the following:

import { ButtonComponent } from './button.component'

describe('ButtonComponent', () => {
  it('can mount', () => {
    cy.mount(ButtonComponent)
  })
})

Part 2

By having this, we could then also wrap the current Angular CLI component generator to also call @cypress/schematic:ct as well. This way users who use the angular CLI to generate a component would get the following files

ng generate component button

Scaffolded Files:

  • button.component.ts
  • button.component.css
  • button.component.cy.ts

This would also require a schematic that would also setup your Angular CLI project to use this schematic. Something that would look like the following:

ng add cypress-angular-ct

To increase adoption of Angular CT support we could also throw this as a prompt at the end of the Cypress Launchpad to ask users if they want to add this schematic or something like that

Why is this needed?

This will improve the developer experience for users by making the generating of CT specs super simple and ultimately an after thought if we wrap around the ng generate component schematic. By implementing this we will increase users adoption of Angular CT and improve over DX by doing all the boilerplate work for developers.

Other

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jordanpowell88commented, Sep 6, 2022

@d-koppenhagen yes this is mostly implemented but we still need to add this as part of the setup

0reactions
jordanpowell88commented, Oct 17, 2022

@w0wka91 Go for it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating code using schematics - Angular
An add schematic is typically supplied with a library, so that the library can be added to an existing project with ng add...
Read more >
feat: Add Angular CT Schematic · cypress-io/cypress@4ab75a6
Fast, easy and reliable testing for anything that runs in a browser. - feat: Add Angular CT Schematic · cypress-io/cypress@4ab75a6.
Read more >
Building an Angular Schematic for Jest Unit Testing
Schematics are designed to be extensible and reusable with a simple but powerful pipeable interface. They work by applying transformations to a ...
Read more >
Diagram Tools - UI Components - DevExtreme - DevExpress
Angular. app.component.html. app.component.ts. app.module.ts. <dx-diagram #diagram id="diagram" (onCustomCommand)="onCustomCommand($event)"> ...
Read more >
Greenbook Manual (Full) - PGE
manual describe how to construct and install services and equipment. ... Separate CT Cabinet, 201 Amps and Above, Single Phase and. Three Phase....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found