From db3af22140d3c46152eecfc81be41386c7abb79a Mon Sep 17 00:00:00 2001 From: Minko Gechev Date: Tue, 16 Apr 2019 12:20:08 +0200 Subject: [PATCH] fix(@angular-devkit/architect): set proper name in TestingArchitectHost The TestingArchitectHost registers the builders only using their name, ignoring the package name. Later, when Architect looks up the builder using the host, it's unable to find it. You can find a reproduction [here](https://github.com/mgechev/cli-builders-demo). --- .../architect/testing/testing-architect-host.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/angular_devkit/architect/testing/testing-architect-host.ts b/packages/angular_devkit/architect/testing/testing-architect-host.ts index 0eeb068b35..ae2f818ef9 100644 --- a/packages/angular_devkit/architect/testing/testing-architect-host.ts +++ b/packages/angular_devkit/architect/testing/testing-architect-host.ts @@ -41,6 +41,10 @@ export class TestingArchitectHost implements ArchitectHost { throw new Error('Invalid package.json, builders key not found.'); } + if (!packageJson.name) { + throw new Error('Invalid package name'); + } + const builderJsonPath = packageName + '/' + packageJson['builders']; const builderJson = await import(builderJsonPath); const builders = builderJson['builders']; @@ -54,7 +58,7 @@ export class TestingArchitectHost implements ArchitectHost { if (!b.implementation) { continue; } const handler = await import(builderJsonPath + '/../' + b.implementation); const optionsSchema = await import(builderJsonPath + '/../' + b.schema); - this.addBuilder(builderName, handler, b.description, optionsSchema); + this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema); } } addTarget(target: Target, builderName: string, options: json.JsonObject = {}) {