diff options
author | isaacs <i@izs.me> | 2021-05-07 02:06:29 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-10 19:37:12 +0300 |
commit | 1d092144eaaabff63ac8424b40b2286822be7677 (patch) | |
tree | cfc63a6d91736f3165fcc4d38431ff3a2819b660 /package.json | |
parent | 1eb7e5c7d466293b472c2506c64e5a89ec84ac2f (diff) |
fix(packages): locale-agnostic string sorting
This adds the 'en' locale to all instances of String.localeCompare
within the CLI codebase.
Tests added for the cases where we're sorting arbitrary user-generated
data. The tests rely on the fact that 'ch' sorts after 'd' in the
`'sk'` locale, but ahead of `'d'` in the `'en'` locale. To ensure that
this is the default behavior if no locale is specified, `LC_ALL=sk` is
set in the test environment.
Other instances of `localeCompare` sort data that the cli controls, so
no tests were added.
Re: https://github.com/npm/cli/issues/2829
PR-URL: https://github.com/npm/cli/pull/3203
Credit: @isaacs
Close: #3203
Reviewed-by: @ruyadorno
Diffstat (limited to 'package.json')
-rw-r--r-- | package.json | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/package.json b/package.json index f3f242ca1..49b347db1 100644 --- a/package.json +++ b/package.json @@ -216,6 +216,9 @@ "Remove the 'files' below once we're done porting old tests over" ], "tap": { + "test-env": [ + "LC_ALL=sk" + ], "color": 1, "files": "test/{lib,bin}", "coverage-map": "test/coverage-map.js", |