Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2021-01-29 20:53:34 +0300
committerisaacs <i@izs.me>2021-02-01 22:58:13 +0300
commit7898f23ea16bc09cec040c880effb36b8eb3bb44 (patch)
tree18b429a8f40a600a84e8946b4adbb4d1500ea2f3
parentdd05ba0c0b2f4c70eb8558c0ecc54889efbe98f5 (diff)
ignore the sort in help-search more broadlyisaacs/broader-istanbul-ignore-in-help-search
It turns out that the other stuff in those objects might also be in random order, so this is still triggering CI coverage failures, albeit more rarely than it used to. Just ignore the whole sort function. It's fine, we implicitly assert on the sortedness in the test, so we know that it is doing its job. PR-URL: https://github.com/npm/cli/pull/2574 Credit: @isaacs Close: #2574 Reviewed-by: @nlf
-rw-r--r--lib/help-search.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/help-search.js b/lib/help-search.js
index d60ef5b4b..d2a181806 100644
--- a/lib/help-search.js
+++ b/lib/help-search.js
@@ -135,12 +135,11 @@ const searchFiles = async (args, data, files) => {
// coverage is ignored here because the contents of results are
// nondeterministic due to either glob or readFiles or Object.entries
- return results.sort((a, b) =>
+ return results.sort(/* istanbul ignore next */ (a, b) =>
a.found.length > b.found.length ? -1
: a.found.length < b.found.length ? 1
: a.totalHits > b.totalHits ? -1
: a.totalHits < b.totalHits ? 1
- /* istanbul ignore next */
: a.lines.length > b.lines.length ? -1
: a.lines.length < b.lines.length ? 1
: 0).slice(0, 10)