Add basic tests for SPA templates (no browser automation yet)
This commit is contained in:
parent
eece782496
commit
95f2b8d375
|
|
@ -10,6 +10,8 @@ namespace Templates.Test.Helpers
|
|||
{
|
||||
"Microsoft.DotNet.Web.ItemTemplates",
|
||||
"Microsoft.DotNet.Web.ProjectTemplates.2.0",
|
||||
"Microsoft.DotNet.Web.Spa.ProjectTemplates",
|
||||
"Microsoft.AspNetCore.SpaTemplates",
|
||||
};
|
||||
|
||||
public static void ReinstallTemplatePackages()
|
||||
|
|
|
|||
|
|
@ -61,6 +61,14 @@ namespace Templates.Test
|
|||
ProcessEx.Run(TemplateOutputDir, "dotnet", args).WaitForExit(assertSuccess: true);
|
||||
}
|
||||
|
||||
protected void RunNpmInstall()
|
||||
{
|
||||
// The first time this runs on any given CI agent it may take several minutes.
|
||||
// If the agent has NPM 5+ installed, it should be quite a lot quicker on
|
||||
// subsequent runs because of package caching.
|
||||
ProcessEx.Run(TemplateOutputDir, "cmd", "/c \"npm install\"").WaitForExit(assertSuccess: true);
|
||||
}
|
||||
|
||||
protected void AssertDirectoryExists(string path, bool shouldExist)
|
||||
{
|
||||
var fullPath = Path.Combine(TemplateOutputDir, path);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Templates.Test
|
||||
{
|
||||
public class SpaTemplateTest : TemplateTestBase
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(null, "angular")]
|
||||
[InlineData(null, "react")]
|
||||
[InlineData(null, "reactredux")]
|
||||
[InlineData(null, "aurelia")]
|
||||
[InlineData(null, "knockout")]
|
||||
[InlineData(null, "vue")]
|
||||
// Just use 'angular' as representative for .NET 4.6.1 coverage, as
|
||||
// the client-side code isn't affected by the .NET runtime choice
|
||||
[InlineData("net461", "angular")]
|
||||
public void SpaTemplate_Works(string targetFrameworkOverride, string template)
|
||||
{
|
||||
RunDotNetNew(template, targetFrameworkOverride);
|
||||
RunNpmInstall();
|
||||
|
||||
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride))
|
||||
{
|
||||
aspNetProcess.AssertOk("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue