testing-library / angular-testing-library

🐙 Simple and complete Angular testing utilities that encourage good testing practices
https://testing-library.com/angular
MIT License
717 stars 91 forks source link

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

Closed timdeschryver closed 3 months ago

timdeschryver commented 3 months ago

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

Hyperxq commented 3 months ago

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 commented 3 months ago

@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 https://github.com/testing-library/angular-testing-library/blob/80ec75d94f08f7c535246c513e6ab7ae66b24c28/projects/testing-library/schematics/ng-add/index.ts#L16-L17 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 commented 3 months ago

@jwillebrands :) ready! https://github.com/testing-library/angular-testing-library/pull/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!