testing-library/angular-testing-library

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

Closed this issue · 3 comments

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

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?

@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.

@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!