Skip to content

Commit de4036c

Browse files
committed
Ensure fail on focus enabled in CI
1 parent e7850f2 commit de4036c

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

build/Program.fs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ System.Environment.CurrentDirectory <- (Path.combine __SOURCE_DIRECTORY__ "..")
1111
// --------------------------------------------------------------------------------------
1212
let isNullOrWhiteSpace = System.String.IsNullOrWhiteSpace
1313

14+
let environVarAsBoolOrDefault varName defaultValue =
15+
let truthyConsts = [
16+
"1"
17+
"Y"
18+
"YES"
19+
"T"
20+
"TRUE"
21+
]
22+
23+
try
24+
let envvar = (Environment.environVar varName).ToUpper()
25+
26+
truthyConsts
27+
|> List.exists ((=) envvar)
28+
with _ ->
29+
defaultValue
30+
31+
32+
let isCI = lazy (environVarAsBoolOrDefault "CI" false)
33+
1434
let exec cmd args dir env =
1535
let proc =
1636
CreateProcess.fromRawCommandLine cmd args
@@ -86,9 +106,15 @@ let init args =
86106
try
87107
exec "dotnet" $"new globaljson --force --sdk-version {tfmToSdkMap.[tfm]} --roll-forward LatestMinor" "test" Map.empty
88108

109+
let failedOnFocus =
110+
if isCI.Value then
111+
"Expecto.fail-on-focused-tests=true"
112+
else
113+
""
114+
89115
exec
90116
"dotnet"
91-
$"test --blame --blame-hang-timeout 60s --framework {tfm} --logger trx --logger GitHubActions -c {configuration} .\\Ionide.ProjInfo.Tests\\Ionide.ProjInfo.Tests.fsproj"
117+
$"test %s{failedOnFocus} --blame --blame-hang-timeout 60s --framework {tfm} --logger trx --logger GitHubActions -c %s{configuration} .\\Ionide.ProjInfo.Tests\\Ionide.ProjInfo.Tests.fsproj"
92118
"test"
93119
(Map.ofSeq [ "BuildNet9", tfmToBuildNet9Map.[tfm].ToString() ])
94120
|> ignore

0 commit comments

Comments
 (0)