Skip to content

Commit c457442

Browse files
committed
NCrunchOriginalProjectDirectory
1 parent 4dabab9 commit c457442

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/DiffEngine/ContinuousTestingDetector.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ public static class ContinuousTestingDetector
44
{
55
static ContinuousTestingDetector()
66
{
7+
IsNCrunch = Environment.GetEnvironmentVariable("NCRUNCH") != null;
8+
if (IsNCrunch)
9+
{
10+
IsNCrunchExplicitRun = Environment.GetEnvironmentVariable("NCrunch.IsHighPriority") == "1";
11+
NCrunchOriginalProjectDirectory = Path.GetDirectoryName(Environment.GetEnvironmentVariable("NCrunch.OriginalProjectPath"));
12+
}
13+
714
if (AppDomain.CurrentDomain.GetAssemblies()
815
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
916
.Any(a => a.FullName != null &&
@@ -19,8 +26,8 @@ static ContinuousTestingDetector()
1926
}
2027
}
2128

22-
public static bool IsNCrunchExplicitRun { get; } = Environment.GetEnvironmentVariable("NCrunch.IsHighPriority") == "1";
29+
public static bool IsNCrunchExplicitRun { get; }
2330
public static bool Detected { get; set; }
24-
public static bool IsNCrunch { get; } = Environment.GetEnvironmentVariable("NCRUNCH") != null;
25-
public static string? NCrunchOriginalProject { get; } = Environment.GetEnvironmentVariable("NCrunch.OriginalProjectPath");
31+
public static bool IsNCrunch { get; }
32+
public static string? NCrunchOriginalProjectDirectory { get; }
2633
}

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649</NoWarn>
5-
<Version>10.4.2</Version>
5+
<Version>10.4.3</Version>
66
<AssemblyVersion>1.0.0</AssemblyVersion>
77
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
88
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>

0 commit comments

Comments
 (0)