Skip to content

Commit db3af22

Browse files
mgechevalexeagle
authored andcommitted
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).
1 parent 0d235e1 commit db3af22

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: packages/angular_devkit/architect/testing/testing-architect-host.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class TestingArchitectHost implements ArchitectHost {
4141
throw new Error('Invalid package.json, builders key not found.');
4242
}
4343

44+
if (!packageJson.name) {
45+
throw new Error('Invalid package name');
46+
}
47+
4448
const builderJsonPath = packageName + '/' + packageJson['builders'];
4549
const builderJson = await import(builderJsonPath);
4650
const builders = builderJson['builders'];
@@ -54,7 +58,7 @@ export class TestingArchitectHost implements ArchitectHost {
5458
if (!b.implementation) { continue; }
5559
const handler = await import(builderJsonPath + '/../' + b.implementation);
5660
const optionsSchema = await import(builderJsonPath + '/../' + b.schema);
57-
this.addBuilder(builderName, handler, b.description, optionsSchema);
61+
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
5862
}
5963
}
6064
addTarget(target: Target, builderName: string, options: json.JsonObject = {}) {

0 commit comments

Comments
 (0)