Summary
The CompilerOptions.Fsc.help_options.Help tests (variants 1-3) intermittently fail on Linux CI because the --consolecolors default shows (off by default) instead of the baseline's (on by default).
Root cause
enableConsoleColoring is a global mutable (let mutable enableConsoleColoring = true in src/Compiler/Driver/CompilerOptions.fs:510). The FscOptionTests.fs test at line 57-61 exercises --consolecolors-, which sets this global to false. Since checker.Compile runs in-process, the mutation persists across tests.
When help_options runs after the --consolecolors- test, enableConsoleColoring is still false, so the help output says (off by default) instead of (on by default), mismatching the baseline.
Reproduction
The failure depends on xUnit test execution order. It reproduces consistently on Linux CI but not locally (different parallelism/ordering). Observed on PR #19021 across multiple CI runs.
Relevant code
- Global mutable:
src/Compiler/Driver/CompilerOptions.fs:510
- Help text generation:
src/Compiler/Driver/CompilerOptions.fs:884 — reads enableConsoleColoring at format time
- Mutating test:
tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/FscOptionTests.fs:57-61
- Failing test:
tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/misc/misc.fs:15-44
- Baseline:
tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/misc/compiler_help_output.bsl
Possible fixes
- Reset
enableConsoleColoring = true before each help_options test
- Save/restore the global in
FscOptionTests after exercising --consolecolors-
- Longer term: eliminate the global mutable by threading the setting through
TcConfigBuilder
Summary
The
CompilerOptions.Fsc.help_options.Helptests (variants 1-3) intermittently fail on Linux CI because the--consolecolorsdefault shows(off by default)instead of the baseline's(on by default).Root cause
enableConsoleColoringis a global mutable (let mutable enableConsoleColoring = trueinsrc/Compiler/Driver/CompilerOptions.fs:510). TheFscOptionTests.fstest at line 57-61 exercises--consolecolors-, which sets this global tofalse. Sincechecker.Compileruns in-process, the mutation persists across tests.When
help_optionsruns after the--consolecolors-test,enableConsoleColoringis stillfalse, so the help output says(off by default)instead of(on by default), mismatching the baseline.Reproduction
The failure depends on xUnit test execution order. It reproduces consistently on Linux CI but not locally (different parallelism/ordering). Observed on PR #19021 across multiple CI runs.
Relevant code
src/Compiler/Driver/CompilerOptions.fs:510src/Compiler/Driver/CompilerOptions.fs:884— readsenableConsoleColoringat format timetests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/FscOptionTests.fs:57-61tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/misc/misc.fs:15-44tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/misc/compiler_help_output.bslPossible fixes
enableConsoleColoring = truebefore eachhelp_optionstestFscOptionTestsafter exercising--consolecolors-TcConfigBuilder