From e8d951af4f9e3c9b3c378689432b1743ecba5ae5 Mon Sep 17 00:00:00 2001 From: lipata Date: Thu, 30 Jun 2022 09:52:45 +0300 Subject: [PATCH] test(@angular/cli): correctly handle --collection option in ng g #23414 --- .../tests/commands/ng-generate-collection.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/legacy-cli/e2e/tests/commands/ng-generate-collection.ts diff --git a/tests/legacy-cli/e2e/tests/commands/ng-generate-collection.ts b/tests/legacy-cli/e2e/tests/commands/ng-generate-collection.ts new file mode 100644 index 000000000000..8d4a37bc0a4a --- /dev/null +++ b/tests/legacy-cli/e2e/tests/commands/ng-generate-collection.ts @@ -0,0 +1,19 @@ +import { execAndWaitForOutputToMatch } from '../../utils/process'; + +export default async function () { + const currentDirectory = process.cwd(); + + try { + process.chdir('..'); + + // The below is a way to validate that the `--collection` option is being considered. + await execAndWaitForOutputToMatch( + 'ng', + ['g', '--collection', 'invalid-schematic'], + /Collection "invalid-schematic" cannot be resolved/, + ); + } finally { + // Change directory back + process.chdir(currentDirectory); + } +}