Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-safe-get-env is flaky cause of non ASCII characters #23097

Open
lovinglyy opened this issue Sep 26, 2018 · 4 comments
Open

test-safe-get-env is flaky cause of non ASCII characters #23097

lovinglyy opened this issue Sep 26, 2018 · 4 comments
Labels
process Issues and PRs related to the process subsystem. windows Issues and PRs related to the Windows platform.

Comments

@lovinglyy
Copy link
Contributor

Version: 10.10.0
Platform: Windows 10

By checking all envs in process.env with assert.strictEqual, ASCII characters can make the test to get flaky results, as they will be "equal" but with different characters.

Example:

AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
  expected - actual

- 's´┐¢b ago 25 21:24:21 2018'
  'sáb ago 25 21:24:21 2018'

That is from ChocolateyLastPathUpdate, can be the env and it has non ASCII characters, by getting the date locally, but I guess that ChocolateyLastPathUpdate can be there or no, aswell any other env with non ASCII characters.
This will happen with any assert test, as Object.is() treat strings this way: both strings of the same length with the same characters in the same order(from mdn), I thought about making it a feature request for ASCII support in assert when using it with strings but it looks very specific and I guess that it can not be normalized in all scenarios.

The test could not do assert.strictEqual if safeGetenv(oneEnv) or process.env[oneEnv] has non ascii characters or have a "safe value" of strings that can be not equal, before getting an AssertionError.

@lovinglyy lovinglyy changed the title test-util-internal is flaky in systems with non ASCII characters test-util-internal is flaky cause of non ASCII characters Sep 26, 2018
@Trott
Copy link
Member

Trott commented Nov 5, 2018

@nodejs/testing

@Trott Trott added windows Issues and PRs related to the Windows platform. and removed windows Issues and PRs related to the Windows platform. labels Nov 14, 2018
@Trott
Copy link
Member

Trott commented Nov 14, 2018

Is this bug Windows-specific? I'm trying to replicate it with funky environment variables on macOS but everything I try works just fine...

@bnoordhuis bnoordhuis added windows Issues and PRs related to the Windows platform. process Issues and PRs related to the process subsystem. labels Nov 14, 2018
@bnoordhuis
Copy link
Member

Yes, Windows-specific. I'll add the label back again. :-)

Specifically, process.env uses GetEnvironmentVariableW(), whereas safeGetenv() uses plain getenv().

@Trott
Copy link
Member

Trott commented Nov 18, 2018

@nodejs/platform-windows (in case someone wants to try to fix, or come up with a known_issues test for it)

@jasnell jasnell added this to Known flakes in Flakees in CI via automation Jun 25, 2020
@tniessen tniessen changed the title test-util-internal is flaky cause of non ASCII characters test-safe-get-env is flaky cause of non ASCII characters Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem. windows Issues and PRs related to the Windows platform.
Projects
Flakees in CI
  
Known flakes
Development

No branches or pull requests

3 participants