chubin/cheat.sh

Tests are failing because of color schema changes

abitrolly opened this issue · 6 comments

Tests are failing, because ANSI markup is different. This is a server bug, but need to check it is only for https://cht.sh or if it is repeated with local server in Docker container. Need to turn off upstream query for Docker tests.

-^[[38;5;246;03m# To display everything in <dir>, excluding hidden files:^[[39;00m
+^[[38;5;248;03m# To display everything in <dir>, excluding hidden files:^[[39;00m

Is it okay, if I take a look at this issue? I would appreciate it if you have any pointers on how to approach it.

@poojankhanpara sure. The problem is conversion between cheat text into ANSI sequences. As you see, in ;246; in tests is replaced by ;248; in docker. The ANSI codes look like incomplete 24-bit code https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit Maybe they are invalid.

Thanks! I tried using both ;246; and ;248; and it turns out it changes the color of the comments to a bit brighter shade of gray. Where is the color added to the comments? Maybe there is no need to turn off upstream tests for docker if we can get the same colored comment on docker too.

Thinking of adding an option to remove ansi styling with the help of ?T option in run_tests.sh. And carefully recapture the output.

nega0 commented

The change from ;246;;248; is a result of an update to pygments (pygments/pygments@1458c66). Running

$ CHEATSH_UPDATE_TESTS_RESULTS=YES bash tests/run-tests.sh

will update the results files (tests/results/*) in your working directory. Updating tests/results/* will also take care of some content updates in the various cheatsheet repositories.

Note that there were recent updates to colored that can also trip you up... See #355.

I tried to run a local server with legacy pygments and colored module and I am still getting the same color change difference.

Somehow tests on live production are passing.
CHEATSH_TEST_STANDALONE="NO" CHTSH_URL="https://cheat.sh" bash tests/run-tests.sh

I have a feeling that recapturing the output might hide the real problem.