Skip to content

ng add schematic should ask if you want to install jest-dom #477

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

Closed
timdeschryver opened this issue Aug 3, 2024 · 3 comments
Closed

ng add schematic should ask if you want to install jest-dom #477

timdeschryver opened this issue Aug 3, 2024 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@timdeschryver
Copy link
Member

See title.
If the user wants, it should add @testing-library/jest-dom as a dev dependency.

@timdeschryver timdeschryver added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 3, 2024
@Hyperxq
Copy link
Contributor

Hyperxq commented Aug 5, 2024

I could help with anything relate with schematics. But I have a question @timdeschryver :
I am seeing the ng-add file and I can see that this schematic is only installing: @testing-library/dom.

Do you need that this schematics install jest-dom and others too?

@timdeschryver
Copy link
Member Author

@Hyperxq correct!
It's only installing @tl/dom because @tl/angular is automatically installed.
With this issue we also want to install the jest-dom package as a dependency.

This can be similar to

context.logger.info(`Adding '@testing-library/dom' as a dev dependency.`);
addPackageJsonDependency(tree, { name: dtl, type: NodeDependencyType.Dev, overwrite: false, version: '^10.0.0' });
with the exception that this is optional and that it should be a prompt.

To add a prompt see the docs at https://angular.dev/tools/cli/schematics-authoring#schematic-prompts
This config should be added to https://github.com/testing-library/angular-testing-library/blob/main/projects/testing-library/schematics/ng-add/schema.json and https://github.com/testing-library/angular-testing-library/blob/main/projects/testing-library/schematics/ng-add/schema.ts.

@Hyperxq
Copy link
Contributor

Hyperxq commented Aug 6, 2024

@jwillebrands :) ready!
#478

I am the creator of Project Builder. If you want to create schematics for any framework or JS vainilla It will be a pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants