mocha icon indicating copy to clipboard operation
mocha copied to clipboard

[WSL] Test report corruption

Open mcandre opened this issue 4 years ago • 5 comments

Prerequisites

  • [x] Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • [x] Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • [x] 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • [x] Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

The checkmark and ex symbols used by mocha, don't render well in many Windows shell environments. For example, in Windows Subsystem for Linux, they show up as the missing Unicode question mark glyph.

Steps to Reproduce

Use mocha in WSL.

Expected behavior: The report renders successfully.

Actual behavior: Special characters are mangled.

Reproduces how often: 100%

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 6.2.0

  • The output of node --version: 8.16.0

  • Your operating system

    • name and version: Windows 10
    • architecture (32 or 64-bit): 64
  • Your shell (e.g., bash, zsh, PowerShell, cmd): zsh inside Ubuntu inside WSL inside Windows 10.

Additional Information

Recommended to detect WSL, and use plain ASCII characters in this case. The number of Windows shell environments that don't support Unicode characters well, far outnumbers the Windows shell environments that do.

mcandre avatar Jun 26 '20 22:06 mcandre

This sounds plausible. You can see the same issue when using "Git Bash" under Windows. The fix would live in lib/reporters/base.js, whatever it is--but we probably want to detect terminal capabilities (encoding?) instead of whatever we're doing.

boneskull avatar Jun 30 '20 20:06 boneskull

IMO we should consume log-symbols here; we already use it (elsewhere).

boneskull avatar Jun 30 '20 20:06 boneskull

Hello

I tried to reproduce this issue. And I found some reason.

My operating system

name and version: Windows 10
architecture (32 or 64-bit): 64
Your shell (e.g., bash, zsh, PowerShell, cmd): Git Bash

In conclusion, when running node, if it is executed with double quotes like "node", the report will collapse This seems to be a problem with any reports other as well as Mocha.

This is the situation KakaoTalk_Photo_2020-07-25-18-46-26

This was not solved using log-symbols . And this had no problem when using cmd or powershell.

Using log-symbols still is good for removing routine for win32 about symbols IMO

MoonSupport avatar Jul 25 '20 09:07 MoonSupport

Hello I am a first timer. Can anyone help regarding this issue?

Blakelist7 avatar Nov 23 '20 13:11 Blakelist7

changing the output is a breaking change. I expect it to land in mocha v9. will take a look at the PR before then

boneskull avatar Nov 23 '20 21:11 boneskull

I'm working on Windows/WSL 2.0 and can't confirm this rendering issue anymore. Meanwhile we also have switched to using log-symbols.

We aren't going to pursue this issue any further. Trying to handle rendering deficiencies of individuell shells is out of Mocha's scope.

juergba avatar Oct 16 '22 17:10 juergba