fix(@angular/cli): serialize configuration as a single argv token in run_target strategies - #33657
Conversation
…run_target strategies build-target-strategy.ts, generic-target-strategy.ts, and unit-test-strategy.ts all pushed the configuration value as a separate argv element after '-c'. Since the ng CLI's argument parser does not consume a following token as the value of a string option when that token itself starts with a dash, a configuration value crafted to look like a flag (e.g. "--outputPath=...") is instead parsed as an independent, legitimately-declared option of the target's builder, silently overriding it. Serialize configuration as a single '--configuration=value' token, matching the format serializeOptions() already uses for every other option, which is not affected by this because the value is bound to the key within one argv element. Updated the two existing spec assertions that checked the old argv shape.
There was a problem hiding this comment.
Code Review
This pull request updates the target execution strategies (build, generic, and unit test) to use the long-form --configuration=value argument instead of the short-hand -c flag when constructing command-line arguments. The corresponding unit tests have also been updated to reflect this change. I have no feedback to provide as there are no review comments.
|
Gentle bump, same as #33653. Open two weeks with no reviewer assigned, while #33654 from the same MCP batch was reviewed and merged within a few days, so this likely slipped past the queue. Happy to rebase if it has gone stale. @clydin could you take a look, or point it at whoever owns the MCP run_target strategies? |
|
Thank you for the contribution. |
|
Fixed, thanks for the review. |
…run_target strategies (#33657) * fix(@angular/cli): serialize configuration as a single argv token in run_target strategies build-target-strategy.ts, generic-target-strategy.ts, and unit-test-strategy.ts all pushed the configuration value as a separate argv element after '-c'. Since the ng CLI's argument parser does not consume a following token as the value of a string option when that token itself starts with a dash, a configuration value crafted to look like a flag (e.g. "--outputPath=...") is instead parsed as an independent, legitimately-declared option of the target's builder, silently overriding it. Serialize configuration as a single '--configuration=value' token, matching the format serializeOptions() already uses for every other option, which is not affected by this because the value is bound to the key within one argv element. Updated the two existing spec assertions that checked the old argv shape. * fix(@angular/cli): apply prettier formatting to unit-test-strategy_spec.ts (cherry picked from commit ecf8c08)
build-target-strategy.ts, generic-target-strategy.ts, and unit-test-strategy.ts all pushed the configuration value as a separate argv element after '-c'. Since the ng CLI's argument parser does not consume a following token as the value of a string option when that token itself starts with a dash, a configuration value crafted to look like a flag (e.g. "--outputPath=...") is instead parsed as an independent, legitimately-declared option of the target's builder, silently overriding it.
Serialize configuration as a single '--configuration=value' token, matching the format serializeOptions() already uses for every other option, which is not affected by this because the value is bound to the key within one argv element.
Updated the two existing spec assertions that checked the old argv shape.