Honor --no-build for TypeScript AppHosts#17994
Conversation
Skip guest pre-execute build/typecheck commands when --no-build is supplied for both run and publish paths. Add TypeScript-shaped regression coverage to ensure tsc is not launched while the AppHost still executes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17994Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17994" |
There was a problem hiding this comment.
Pull request overview
This pull request fixes Aspire CLI’s guest (non-.NET) AppHost execution so --no-build fully honors its contract for TypeScript AppHosts by skipping the guest runtime’s pre-execute typecheck/build step (npx --no-install tsc --noEmit) during both run and publish, while still executing the AppHost via tsx.
Changes:
- Thread
NoBuildthrough the guest AppHost run and publish execution paths inGuestAppHostProject. - Add a
noBuildflag toGuestRuntime.RunAsync/PublishAsyncand skipRuntimeSpec.PreExecutewhen set. - Add focused unit tests asserting
--no-buildbypassestscpre-execute but still launches the AppHost command.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Projects/GuestRuntimeTests.cs | Adds regression tests verifying noBuild: true skips TypeScript tsc pre-execute while still running the AppHost via npx tsx. |
| src/Aspire.Cli/Projects/GuestRuntime.cs | Introduces noBuild parameter and conditionally skips running RuntimeSpec.PreExecute commands for run/publish. |
| src/Aspire.Cli/Projects/GuestAppHostProject.cs | Passes context.NoBuild into guest runtime run/publish execution so CLI flags affect guest AppHosts. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 0
JamesNK
left a comment
There was a problem hiding this comment.
LGTM. Production logic is correct — noBuild properly threads through and skips RunPreExecuteCommandsAsync while still running the execute command. Two minor nits on redundant test assertions.
Remove redundant negative assertions from the TypeScript no-build regression tests now that Assert.Single and the command argument checks validate the full call list. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❌ CLI E2E Tests failed — 112 passed, 1 failed, 2 unknown (commit ❌ Failed Tests
View all recordings
📹 Recordings uploaded automatically from CI run #27109264025 |
Description
--no-buildshould let users skip build and typecheck work before launching an AppHost. TypeScript AppHosts still ran the guest pre-execute command (npx --no-install tsc --noEmit) during run and publish, so--no-builddid not fully honor that contract for TypeScript.This threads
NoBuildthrough the guest AppHost run and publish paths and skips runtime pre-execute build/check commands when it is set. The AppHost execution command still runs, so TypeScript AppHosts continue to launch throughtsxwith the normal run or publish arguments.User-facing usage
Validation
dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method "*.GuestRuntimeTests.RunAsync_NoBuildSkipsTypeScriptTscAndRunsAppHost" --filter-method "*.GuestRuntimeTests.PublishAsync_NoBuildSkipsTypeScriptTscAndRunsAppHost" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-build --no-launch-profile -- --filter-class "*.GuestRuntimeTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"TS2322: normalrun/publishfail intsc, whilerun --no-buildreaches AppHost execution andpublish --no-buildsucceeds withoutTS2322.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?