cheat.sh icon indicating copy to clipboard operation
cheat.sh copied to clipboard

Tests are failing because of color schema changes

Open abitrolly opened this issue 3 years ago • 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

abitrolly avatar May 20 '22 15:05 abitrolly

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.

pkhanpara avatar Jul 07 '22 06:07 pkhanpara

@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.

abitrolly avatar Jul 07 '22 09:07 abitrolly

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.

pkhanpara avatar Jul 07 '22 20:07 pkhanpara

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

pkhanpara avatar Jul 07 '22 20:07 pkhanpara

The change from ;246;;248; is a result of an update to pygments (https://github.com/pygments/pygments/commit/1458c6669bbc9121eb80b08a7112d81899da7344). 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.

nega0 avatar Aug 09 '22 23:08 nega0

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.

pkhanpara avatar Aug 14 '22 07:08 pkhanpara