-
Notifications
You must be signed in to change notification settings - Fork 851
Description
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— readsenableConsoleColoringat 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 = truebefore eachhelp_optionstest - Save/restore the global in
FscOptionTestsafter exercising--consolecolors- - Longer term: eliminate the global mutable by threading the setting through
TcConfigBuilder
Metadata
Metadata
Labels
Type
Projects
Status