Add TypeScript AppHost publish E2E coverage#17286
Conversation
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 -- 17286Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17286" |
There was a problem hiding this comment.
Pull request overview
Adds a new CLI end-to-end test to provide stable coverage for TypeScript AppHost aspire publish flows that exercise the supported JavaScript publish patterns and validate the generated Docker Compose / Dockerfile artifacts.
Changes:
- Add a TypeScript AppHost publish E2E test that copies the existing JsPublish fixtures into a temporary workspace, runs
aspire publish -o artifacts, and asserts on compose + per-resource Dockerfile output. - Add helper methods to write the TypeScript AppHost and copy fixture directories into the workspace.
- Add Dockerfile/compose assertions for static site, node server, npm-script, and Next.js standalone publish outputs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JamesNK
left a comment
There was a problem hiding this comment.
LGTM. Clean, well-structured E2E test that follows established patterns. Two minor nits inline (duplicated helper, weak assertion fragment) — neither blocking.
| private static void AssertDockerfileContains(string artifactsPath, string resourceName, params string[] expectedFragments) | ||
| { | ||
| var dockerfilePath = Path.Combine(artifactsPath, $"{resourceName}.Dockerfile"); | ||
| Assert.True(File.Exists(dockerfilePath), $"Expected Dockerfile for resource '{resourceName}' at {dockerfilePath}"); | ||
|
|
||
| var content = File.ReadAllText(dockerfilePath); | ||
|
|
||
| foreach (var expectedFragment in expectedFragments) | ||
| { | ||
| Assert.Contains(expectedFragment, content); | ||
| } | ||
| } |
There was a problem hiding this comment.
Nit: This CopyDirectory method is an exact duplicate of the one in JavaScriptPublishTests.cs (line 375). Per the testing conventions in AGENTS.md, shared test helpers are preferred over private duplicates. Consider extracting to a shared location in the Helpers/ directory — CliE2ETestHelpers already has a more robust CopyDirectory (skips node_modules, handles dot-prefixed dirs) that could be made internal.
| "nodeserver", | ||
| "COPY --from=build /app/build /app/build", | ||
| "ENV NODE_ENV=production", | ||
| "USER node", |
There was a problem hiding this comment.
Nit: The fragment "FROM " is guaranteed to match any Dockerfile (every Dockerfile has at least one FROM instruction). It doesn't meaningfully validate the prod-deps stage — " AS prod-deps" is doing the real work. Consider replacing with a more specific fragment like "AS prod-deps" on its own (already covered by the next assertion), or removing this line entirely.
…script-publish-e2e-coverage
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❓ CLI E2E Tests unknown — 95 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26135988588 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…script-publish-e2e-coverage
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
TypeScript AppHost publish support needs stable, non-quarantined E2E coverage for the supported JavaScript publish patterns so regressions are caught on the real CLI publish path instead of only through code generation checks.
This adds a focused CLI E2E test that creates a TypeScript AppHost, publishes through Docker Compose, and validates the generated compose/Dockerfile artifacts for static website, node server, npm-script, and Next.js standalone publishing using the existing JavaScript publish fixtures.
Fixes: #17038
Validation:
./dotnet.sh build tests/Aspire.Cli.EndToEnd.Tests/Aspire.Cli.EndToEnd.Tests.csproj --no-restore /p:SkipNativeBuild=trueunix:///Users/sebastienros/.docker/run/docker.sock.Checklist
<remarks />and<code />elements on your triple slash comments?