Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: testing-library/angular-testing-library
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v17.0.0-beta.1
Choose a base ref
...
head repository: testing-library/angular-testing-library
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v17.0.0-beta.2
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 21, 2024

  1. Copy the full SHA
    67adc5c View commit details
Showing with 18 additions and 2 deletions.
  1. +18 −2 projects/testing-library/schematics/ng-add/index.ts
20 changes: 18 additions & 2 deletions projects/testing-library/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
import {
addPackageJsonDependency,
getPackageJsonDependency,
NodeDependencyType,
} from '@schematics/angular/utility/dependencies';

const dtl = '@testing-library/dom';

export default function (): Rule {
return (host: Tree, context: SchematicContext) => {
return (tree: Tree, context: SchematicContext) => {
const dtlDep = getPackageJsonDependency(tree, dtl);
if (dtlDep) {
context.logger.info(`Skipping installation of '@testing-library/dom' because it's already installed.`);
} else {
context.logger.info(`Adding '@testing-library/dom' as a dev dependency.`);
addPackageJsonDependency(tree, { name: dtl, type: NodeDependencyType.Dev, overwrite: false, version: '^10.0.0' });
}

context.logger.info(
`Correctly installed @testing-library/angular.
See our docs at https://testing-library.com/docs/angular-testing-library/intro/ to get started.`,
);
return host;

return tree;
};
}