Skip to content

Commit

Permalink
ignore the sort in help-search more broadly
Browse files Browse the repository at this point in the history
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: #2574
Credit: @isaacs
Close: #2574
Reviewed-by: @nlf
  • Loading branch information
isaacs committed Feb 1, 2021
1 parent dd05ba0 commit 7898f23
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/help-search.js
Expand Up @@ -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)
Expand Down

0 comments on commit 7898f23

Please sign in to comment.