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.
  • Loading branch information
isaacs committed Jan 29, 2021
1 parent 7b1a539 commit e19a8df
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/help-search.js
Original file line number Diff line number Diff line change
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 e19a8df

Please sign in to comment.