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

Feature Request: Replace Angular Testbed based spec schematics #6293

Open
DDtMM opened this issue Jul 18, 2023 · 3 comments
Open

Feature Request: Replace Angular Testbed based spec schematics #6293

DDtMM opened this issue Jul 18, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@DDtMM
Copy link

DDtMM commented Jul 18, 2023

Describe the feature or problem you'd like to solve

My fingers hurt from having to replace the default code in every spec with some initial code for testing with NgMocks.

Proposed solution

Add a new library project called schematics created using @angular-devkit/schematics-cli.

  • Add spec schematics for the following types where there are existing specs created:
    • class
    • Component
    • Directive
    • Interceptor
    • Pipe
    • Service
  • _Nice to have: Application app.component.spec.ts for both module and standalone components. Seems like a pain for a specific file.
  • Nice to have: ng_add schematic that asks to replace default schematics in a project's angular.json.
  • Package schematics with ng-mocks.
  • Documentation for schematics including instructions for modifying angular.json.

Additional context

@DDtMM DDtMM added the enhancement New feature or request label Jul 18, 2023
@DDtMM DDtMM changed the title Feature Request: Replace Testbed schematics Feature Request: Replace Angular Testbed based spec schematics Jul 18, 2023
@JsantosDK
Copy link
Contributor

JsantosDK commented Jan 21, 2024

Curious on this, would the schematics be placed in the project layout, I assume under ng-mocks/libs/ng-mocks/schematics?

@satanTime
Copy link
Member

satanTime commented Jan 21, 2024

Hi @JsantosDK, right, ng-mocks/libs/ng-mocks contains sources to produce the final build.

@JsantosDK
Copy link
Contributor

What schematics exactly should be done?

  • Test schematics can be added, but with what MockRender or MockComponent or both?
  • An add schematics can be created to manage installation of the lib (would be a good idea if schematics for the spec setup are introduced since when a person installs ng-mocks, they could be asked to install the schematics directly)?
  • Migration schematics to manage breaking changes/version updates?

Note that doing schematics may also introduce incompatibly between old versions.
Not sure we can add schematics that are compatible with both Angular 5 and 17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants