Skip to content

Commit 0bf5227

Browse files
jherby2kViktorHofer
authored andcommitted
Skip included directories that don't exist quietly, rather than throwing.
1 parent 017d277 commit 0bf5227

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

src/coverlet.core/Helpers/InstrumentationHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ private static IEnumerable<string> ExpandIncludeDirectories(string[] includeDire
264264
? Path.GetFullPath(Path.Combine(moduleDirectory, includeDirectory))
265265
: includeDirectory).TrimEnd('*');
266266

267-
if (!Directory.Exists(fullPath))
268-
throw new DirectoryNotFoundException($"The included directory '{fullPath}' does not exist.");
267+
if (!Directory.Exists(fullPath)) continue;
269268

270269
if (includeDirectory.EndsWith("*", StringComparison.Ordinal))
271270
result.AddRange(Directory.GetDirectories(fullPath));

test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@ public void TestIsTypeExcludedAndIncludedWithMatchingAndMismatchingFilter(string
225225
Assert.True(result);
226226
}
227227

228-
[Fact]
229-
public void TestIncludeDirectoryInvalidThrowsDirectoryNotFoundException()
230-
{
231-
string module = typeof(InstrumentationHelperTests).Assembly.Location;
232-
Assert.Throws<DirectoryNotFoundException>(() =>
233-
InstrumentationHelper.GetCoverableModules(module, new[] {"Foobar"}));
234-
}
235-
236228
[Fact]
237229
public void TestIncludeDirectories()
238230
{

0 commit comments

Comments
 (0)