diff --git a/.vscode/settings.json b/.vscode/settings.json index bf0ab1153ea..bffa3d8d9b8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,6 @@ "[json]": { "editor.tabSize": 2 }, + "dotnet.defaultSolution": "Razor.sln", "omnisharp.defaultLaunchSolution": "Razor.sln" } diff --git a/azure-pipelines-integration-dartlab.yml b/azure-pipelines-integration-dartlab.yml index c79988ad607..d8df8eef345 100644 --- a/azure-pipelines-integration-dartlab.yml +++ b/azure-pipelines-integration-dartlab.yml @@ -29,6 +29,8 @@ variables: value: $(Build.SourcesDirectory)\artifacts\log\$(_configuration) - name: __VSNeverShowWhatsNew value: 1 +- name: RAZOR_RUN_ALL_TESTS + value: 'true' stages: - template: \stages\visual-studio\agent.yml@DartLabTemplates diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/ConditionalSkipIdeFactAttribute.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/ConditionalSkipIdeFactAttribute.cs new file mode 100644 index 00000000000..216a8ba73e6 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/ConditionalSkipIdeFactAttribute.cs @@ -0,0 +1,41 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Xunit; + +namespace Microsoft.VisualStudio.Razor.IntegrationTests; + +[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] +public class ConditionalSkipIdeFactAttribute : IdeFactAttribute +{ + private readonly Lazy _runFlakyTests = new(() => Environment.GetEnvironmentVariable("RAZOR_RUN_ALL_TESTS")?.ToLower() == "true"); + + public ConditionalSkipIdeFactAttribute() + { + } + + private string _issue = ""; + public string Issue + { + get => _issue; + set + { + _issue = value; + + if (!_runFlakyTests.Value) + { + #pragma warning disable CS0618 + Skip = _issue; + #pragma warning restore CS0618 + } + } + } + + [Obsolete("Use Issue instead of Skip")] + public new string Skip + { + get => base.Skip; + set => base.Skip = value; + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/DiagnosticTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/DiagnosticTests.cs index 48f4f428710..7b283caf082 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/DiagnosticTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/DiagnosticTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.Razor.IntegrationTests; public class DiagnosticTests : AbstractRazorEditorTest { - [IdeFact(Skip = "https://github.com/dotnet/razor/issues/8150")] + [ConditionalSkipIdeFact(Issue = "https://github.com/dotnet/razor/issues/8150")] public async Task Diagnostics_ShowErrors_Razor() { // Arrange @@ -48,7 +48,7 @@ public void Function(){ }); } - [IdeFact(Skip = "https://github.com/dotnet/razor/issues/8150")] + [ConditionalSkipIdeFact(Issue = "https://github.com/dotnet/razor/issues/8150")] public async Task Diagnostics_ShowErrors_Html() { // Arrange @@ -80,7 +80,7 @@ await TestServices.Editor.SetTextAsync(@" }); } - [IdeFact(Skip = "https://github.com/dotnet/razor/issues/8150")] + [ConditionalSkipIdeFact(Issue = "https://github.com/dotnet/razor/issues/8150")] public async Task Diagnostics_ShowErrors_CSharp() { // Arrange @@ -112,7 +112,7 @@ await TestServices.Editor.SetTextAsync(@" }); } - [IdeFact(Skip = "https://github.com/dotnet/razor/issues/8150")] + [ConditionalSkipIdeFact(Issue = "https://github.com/dotnet/razor/issues/8150")] public async Task Diagnostics_ShowErrors_CSharp_NoDocType() { // Why this test, when we have the above test, and they seem so similar, and we also have Diagnostics_ShowErrors_CSharpAndHtml you ask? Well I'll tell you! @@ -152,7 +152,7 @@ await TestServices.Editor.SetTextAsync(@" }); } - [IdeFact(Skip = "https://github.com/dotnet/razor/issues/8150")] + [ConditionalSkipIdeFact(Issue = "https://github.com/dotnet/razor/issues/8150")] public async Task Diagnostics_ShowErrors_CSharpAndHtml() { // Arrange