Closed rmunn closed 4 years ago
Expecto doesn't change echo settings. It makes any output colour changes and change back atomic by sending them to the console in one go. Same for backspace and update for the spinner.
It could possibly be an issue with https://github.com/YoloDev/YoloDev.Expecto.TestSdk which is the dotnet test integration. You should open an issue there to see if it could be causing this.
Does dotnet test
set an env var that we can look for?
This bug is not exclusive to tests run within the Expecto framework. I'm seeing the same bug on ubuntu with dotnet test
and I'm using xunit.
OS: Ubuntu 18.04.3 .NET Core 3.1 xunit 2.4.1 Microsoft.NET.Test.Sdk 16.4.0
I've also seen this after other dotnet commands that didn't involve Expecto, so this issue is in the wrong place. @beevik, thanks for filing the one against the dotnet
project; that's probably the root cause of this bug, so I'll close this one and only reopen if I get reason to suspect that Expecto is actually contributing to the problem.
Bug description:
Sometimes after running Expecto tests via
dotnet test
, the terminal ends up in a state where it no longer echoes input. This can be solved by simply runningreset
orstty echo
, but it shouldn't be happening in the first place.Note that this does NOT happen if the Expecto tests are run directly using something like
dotnet run --framework netcoreapp2.0 --debug
in thetests/ProjName.Tests
directory. I have only seen this happen when they are run via thedotnet test
runner, but in that environment I see it happen about half the time.To reproduce:
dotnet test
(if using MiniScaffold, run theDotnetTest
build target)Expected behavior:
The terminal should be reset to "echo" mode (see https://askubuntu.com/q/171449/ for a good explanation for anyone unfamiliar with this behavior of Linux terminals) after the tests have run.
Environment:
Additional context:
Since this doesn't happen every time, I suspect a race condition between Expecto and the
dotnet test
runner, both of which print their own progress feedback (Expecto prints a spinner,dotnet test
prints a series of dots). If both of them are saving the terminal settings, then restoring them later, it's possible that a certain order of save - turn off echo - restore is triggering this bug. E.g.:dotnet test
saves current stty settingsdotnet test
turns off terminal echodotnet test
restores its saved stty settings (turning echo on)It's arguable whether this is a bug in Expecto or in
dotnet test
, but it's very unlikely thatdotnet test
is going to change quickly, so the right place to fix this race condition (if I'm right about the cause) is probably in Expecto.