Architect#scheduleBuilder or context.scheduleBuilder results in incorrect target on context
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- build-system
Research direction
Start with packages/angular_devkit/architect/src/index_spec.ts and reproduce the failure using yarn bazel test //packages/angular_devkit/architect:architect_test. Trace the builder context through packages/angular_devkit/architect/src/create-builder.ts, where the stack points, and verify that scheduleBuilder provides a target matching its declared TypeScript interface. Done means the focused architect test passes with a valid target.
Written by the indexing model from the issue text.
Description
🐞 Bug report
Command (mark with an x)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Not that I know of
Description
If a builder is executed via architect.scheduleBuilder, that builder is passed a context that doesn't match the declared interface in typescript. The same happens when using context.scheduleBuilder if no target is passed via the scheduleOptions.
console.log(context.target);
// logs {project: undefined, target: undefined, configuration: undefined}
// but type is {project: string, target: string, configuration?: string} | undefined
🔬 Minimal Reproduction
Run yarn bazel test //packages/angular_devkit/architect:architect_test with the following patch:
diff --git a/packages/angular_devkit/architect/src/index_spec.ts b/packages/angular_devkit/architect/src/index_spec.ts
index 57d76c5a6..bbd59b3fc 100644
--- a/packages/angular_devkit/architect/src/index_spec.ts
+++ b/packages/angular_devkit/architect/src/index_spec.ts
@@ -36,10 +36,12 @@ describe('architect', () => {
options = {};
called = 0;
- testArchitectHost.addBuilder('package:test', createBuilder(async o => {
+ testArchitectHost.addBuilder('package:test', createBuilder(async (o, ctx) => {
called++;
options = o;
+ expect(ctx.target != null && ctx.target.target == null).toBe(false);
+
return new Promise<BuilderOutput>(resolve => {
setTimeout(() => resolve({ success: true }), 10);
});
🔥 Exception or Error
Failures:
1) architect runs builders parallel
Message:
Expected true to be false.
Stack:
Error: Expected true to be false.
at
at packages/angular_devkit/architect/src/index_spec.ts:43:63
at onInput (packages/angular_devkit/architect/src/create-builder.ts:201:20)
at SafeSubscriber._next (packages/angular_devkit/architect/src/create-builder.ts:87:17)
🌍 Your Environment
Master branch on this repo
Anything else relevant?
- Dominant language
- TypeScript
- Stars
- 27k
- Forks
- 11.8k
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 176
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from angular/angular-cli
-
area: @angular/build gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
angular/angular-cli#33055 · 1 comment · 3 reactions ·
-
area: @angular/build gemini-triaged
Difficulty 4/5 3-5 days Newbie friendliness 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 assignee ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 assignee ·
All issues in angular/angular-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
melgarafael/DeskcommCRM#1451 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·