Skip to content

Commit b2d0c4e

Browse files
authored
Minor improvements to integration tests (#10319)
* Reference the razor extension from the integration test project, so that making a code change and running a test from Test Explorer actually causes the new code to be tested * Manually initialize the `ThrowingTraceListener` because it seems the module initializer doesn't work with our wacky test infra (and I choose not to try to understand the latter :P) * Up the log level of the test logger, so the Text Explorer output includes the full logs of the test run
2 parents e66b0a5 + b12682f commit b2d0c4e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractIntegrationTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public abstract class AbstractIntegrationTest : AbstractIdeIntegrationTest
3333

3434
public override async Task InitializeAsync()
3535
{
36+
// Not sure why the module initializer doesn't seem to work for integration tests
37+
ThrowingTraceListener.Initialize();
38+
3639
await base.InitializeAsync();
3740
}
3841

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/OutputInProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task<ILogger> SetupIntegrationTestLoggerAsync(ITestOutputHelper tes
3333
// We can't remove logging providers, so we just keep track of ours so we can make sure it points to the right test output helper
3434
if (_testLoggerProvider is null)
3535
{
36-
_testLoggerProvider = new TestOutputLoggerProvider(testOutputHelper, LogLevel.Warning);
36+
_testLoggerProvider = new TestOutputLoggerProvider(testOutputHelper);
3737
logger.AddLoggerProvider(_testLoggerProvider);
3838
}
3939
else

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Microsoft.VisualStudio.Razor.IntegrationTests.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
<PrivateAssets>All</PrivateAssets>
2121
<CopyLocalSatelliteAssemblies>False</CopyLocalSatelliteAssemblies>
2222
</ProjectReference>
23+
<ProjectReference Include="..\..\src\Microsoft.VisualStudio.RazorExtension\Microsoft.VisualStudio.RazorExtension.csproj">
24+
<PrivateAssets>All</PrivateAssets>
25+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
26+
<CopyLocalSatelliteAssemblies>False</CopyLocalSatelliteAssemblies>
27+
</ProjectReference>
2328
<ProjectReference Include="..\..\src\RazorDeployment\RazorDeployment.csproj" Private="False" Condition="'$(BuildDependencyVsix)' == 'true'">
2429
<PrivateAssets>All</PrivateAssets>
2530
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
@@ -45,8 +50,8 @@
4550
import the package ourselves, but as an implicit definition to stop Nuget complaining.
4651
TL;DR: MSBuild was designed to cause pain.
4752
-->
48-
<PackageReference Include="xunit.runner.console" Version="$(XUnitRunnerConsoleVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
49-
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true"/>
53+
<PackageReference Include="xunit.runner.console" Version="$(XUnitRunnerConsoleVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
54+
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" IsImplicitlyDefined="true" PrivateAssets="all" Publish="true" />
5055
</ItemGroup>
5156

5257
<ItemGroup>

0 commit comments

Comments
 (0)