diff --git a/.gitignore b/.gitignore
index ace214b5a..478b5fc8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -315,3 +315,4 @@ coverage.*.cobertura.xml
coverage.*.opencover.xml
FolderProfile.pubxml
+/NuGet.config
diff --git a/Directory.Build.props b/Directory.Build.props
index 91ee686a1..74a9fdaea 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -38,11 +38,16 @@
-
+
$(RepoRoot)artifacts/testresults/$(Configuration.ToLowerInvariant())
@(VSTestLogger)
+
+ $(RepoRoot)artifacts\testresults\$(Configuration.ToLowerInvariant())
+ @(VSTestLogger)
+
+
+ -->
diff --git a/eng/publish-coverage-results.yml b/eng/publish-coverage-results.yml
index 58dda6870..796d8f577 100644
--- a/eng/publish-coverage-results.yml
+++ b/eng/publish-coverage-results.yml
@@ -26,7 +26,7 @@ steps:
artifact: CoverageResults_$(Agent.Os)_$(BuildConfiguration)
condition: ${{parameters.condition}}
-- task: PublishCodeCoverageResults@1
+- task: PublishCodeCoverageResults@2
displayName: 'Publish code coverage'
condition: ${{parameters.condition}}
inputs:
diff --git a/src/coverlet.core/Helpers/InstrumentationHelper.cs b/src/coverlet.core/Helpers/InstrumentationHelper.cs
index 0c271c8ec..82b66056b 100644
--- a/src/coverlet.core/Helpers/InstrumentationHelper.cs
+++ b/src/coverlet.core/Helpers/InstrumentationHelper.cs
@@ -25,7 +25,7 @@ internal class InstrumentationHelper : IInstrumentationHelper
private readonly ISourceRootTranslator _sourceRootTranslator;
private ILogger _logger;
private static readonly RegexOptions s_regexOptions =
- RegexOptions.Multiline | RegexOptions.Compiled | RegexOptions.IgnoreCase;
+ RegexOptions.Multiline | RegexOptions.Compiled;
public InstrumentationHelper(IProcessExitHandler processExitHandler, IRetryHelper retryHelper, IFileSystem fileSystem, ILogger logger, ISourceRootTranslator sourceRootTranslator)
{
@@ -420,7 +420,7 @@ public bool IsTypeIncluded(string module, string type, string[] includeFilters)
}
public bool IsLocalMethod(string method)
- => new Regex(WildcardToRegex("<*>*__*|*"), s_regexOptions, TimeSpan.FromSeconds(10)).IsMatch(method);
+ => Regex.IsMatch(method, WildcardToRegex("<*>*__*|*"));
public void SetLogger(ILogger logger)
{
@@ -442,7 +442,7 @@ private static bool IsTypeFilterMatch(string module, string type, string[] filte
typePattern = WildcardToRegex(typePattern);
modulePattern = WildcardToRegex(modulePattern);
- if (new Regex(typePattern, s_regexOptions, TimeSpan.FromSeconds(10)).IsMatch(type) && new Regex(modulePattern, s_regexOptions, TimeSpan.FromSeconds(10)).IsMatch(module))
+ if (Regex.IsMatch(type, typePattern) && Regex.IsMatch(module, modulePattern))
return true;
}
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 46ee48927..d7ecd93ee 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -3,6 +3,6 @@
true
- $(NoWarn);NU1301
+ $(NoWarn);NU1301;IDE0007
diff --git a/test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs b/test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs
index 91edf8589..557835806 100644
--- a/test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs
+++ b/test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs
@@ -112,23 +112,29 @@ public void TestBackupOriginalModule()
Assert.True(File.Exists(backupPath));
}
- [Fact]
- public void TestIsValidFilterExpression()
+ [Theory]
+ [InlineData("[*]*")]
+ [InlineData("[*]*core")]
+ [InlineData("[assembly]*")]
+ [InlineData("[*]type")]
+ [InlineData("[assembly]type")]
+ [InlineData("[coverlet.*.tests?]*")]
+ [InlineData("[*]Coverlet.Core*")]
+ [InlineData("[coverlet.*]*")]
+ public void TestIsValidFilterExpression(string pattern)
+ {
+ Assert.True(_instrumentationHelper.IsValidFilterExpression(pattern));
+ }
+
+ [Theory]
+ [InlineData("[*]")]
+ [InlineData("[-]*")]
+ [InlineData("*")]
+ [InlineData("][")]
+ [InlineData(null)]
+ public void TestInValidFilterExpression(string pattern)
{
- Assert.True(_instrumentationHelper.IsValidFilterExpression("[*]*"));
- Assert.True(_instrumentationHelper.IsValidFilterExpression("[*]*core"));
- Assert.True(_instrumentationHelper.IsValidFilterExpression("[assembly]*"));
- Assert.True(_instrumentationHelper.IsValidFilterExpression("[*]type"));
- Assert.True(_instrumentationHelper.IsValidFilterExpression("[assembly]type"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("[*]"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("[-]*"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("*"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("]["));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("["));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("[assembly][*"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("[assembly]*]"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression("[]"));
- Assert.False(_instrumentationHelper.IsValidFilterExpression(null));
+ Assert.False(_instrumentationHelper.IsValidFilterExpression(pattern));
}
[Fact]