File tree Expand file tree Collapse file tree
tests/ImageSharp.Drawing.Tests/TestUtilities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,15 +24,25 @@ public static partial class TestEnvironment
2424
2525 private static readonly Lazy < string > SolutionDirectoryFullPathLazy = new Lazy < string > ( GetSolutionDirectoryFullPathImpl ) ;
2626
27- private static readonly Lazy < bool > RunsOnCiLazy = new Lazy < bool > (
28- ( ) => bool . TryParse ( Environment . GetEnvironmentVariable ( "CI" ) , out bool isCi ) && isCi ) ;
29-
3027 internal static bool IsFramework => RuntimeInformation . FrameworkDescription . StartsWith ( ".NET Framework" ) ;
3128
3229 /// <summary>
3330 /// Gets a value indicating whether test execution runs on CI.
3431 /// </summary>
35- internal static bool RunsOnCI => RunsOnCiLazy . Value ;
32+ #if ENV_CI
33+ internal static bool RunsOnCI => true ;
34+ #else
35+ internal static bool RunsOnCI => false ;
36+ #endif
37+
38+ /// <summary>
39+ /// Gets a value indicating whether test execution is running with code coverage testing enabled.
40+ /// </summary>
41+ #if ENV_CODECOV
42+ internal static bool RunsWithCodeCoverage => true ;
43+ #else
44+ internal static bool RunsWithCodeCoverage => false ;
45+ #endif
3646
3747 internal static string SolutionDirectoryFullPath => SolutionDirectoryFullPathLazy . Value ;
3848
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public static Image DebugSave(
6060 bool appendSourceFileOrDescription = true ,
6161 IImageEncoder encoder = null )
6262 {
63- if ( TestEnvironment . RunsOnCI )
63+ if ( TestEnvironment . RunsWithCodeCoverage )
6464 {
6565 return image ;
6666 }
@@ -99,7 +99,7 @@ public static void DebugSave(
9999 object testOutputDetails = null ,
100100 bool appendPixelTypeToFileName = true )
101101 {
102- if ( TestEnvironment . RunsOnCI )
102+ if ( TestEnvironment . RunsWithCodeCoverage )
103103 {
104104 return ;
105105 }
@@ -120,7 +120,7 @@ public static Image<TPixel> DebugSaveMultiFrame<TPixel>(
120120 bool appendPixelTypeToFileName = true )
121121 where TPixel : unmanaged, IPixel < TPixel >
122122 {
123- if ( TestEnvironment . RunsOnCI )
123+ if ( TestEnvironment . RunsWithCodeCoverage )
124124 {
125125 return image ;
126126 }
You can’t perform that action at this time.
0 commit comments