| File: TypeScriptEmptyAppHostTemplateTests.cs | Web Access |
| Project: src\tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj (Aspire.Cli.EndToEnd.Tests) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Aspire.Cli.EndToEnd.Tests.Helpers; using Aspire.Cli.Tests.Utils; using Hex1b.Automation; using Xunit; namespace Aspire.Cli.EndToEnd.Tests; /// <summary> /// End-to-end tests for the TypeScript Empty AppHost template (aspire-ts-empty). /// Validates that aspire new creates a working TypeScript AppHost project /// and that aspire start runs it successfully. /// </summary> public sealed class TypeScriptEmptyAppHostTemplateTests(ITestOutputHelper output) { [Fact] public async Task CreateAndRunTypeScriptEmptyAppHostProject() { var repoRoot = CliE2ETestHelpers.GetRepoRoot(); var installMode = CliE2ETestHelpers.DetectDockerInstallMode(repoRoot); var workspace = TemporaryWorkspace.Create(output); using var terminal = CliE2ETestHelpers.CreateDockerTestTerminal(repoRoot, installMode, output, mountDockerSocket: true, workspace: workspace); var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken); var counter = new SequenceCounter(); var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500)); await auto.PrepareDockerEnvironmentAsync(counter, workspace); await auto.InstallAspireCliInDockerAsync(installMode, counter); await auto.AspireNewAsync("TsEmptyApp", counter, template: AspireTemplate.TypeScriptEmptyAppHost); // Start the empty TypeScript AppHost to verify the scaffolded project works await auto.TypeAsync("cd TsEmptyApp"); await auto.EnterAsync(); await auto.WaitForSuccessPromptAsync(counter); await auto.AspireStartAsync(counter); await auto.AspireStopAsync(counter); await auto.TypeAsync("exit"); await auto.EnterAsync(); await pendingRun; } }