Skip to content

Commit

Permalink
Switch from --sort in tests to preserving glob@8 sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Nov 13, 2024
1 parent 6b5ff68 commit bd50141
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 9 additions & 4 deletions lib/cli/lookup-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ module.exports = function lookupFiles(
debug('looking for files using glob pattern: %s', pattern);
}
files.push(
...glob.sync(pattern, {
nodir: true,
windowsPathsNoEscape: true
})
...glob
.sync(pattern, {
nodir: true,
windowsPathsNoEscape: true
})
// glob@8 and earlier sorted results in en; glob@9 depends on OS sorting.
// This preserves the older glob behavior.
// https://github.com/mochajs/mocha/pull/5250
.sort((a, b) => a.localeCompare(b, 'en'))
);
if (!files.length) {
throw createNoFilesMatchPatternError(
Expand Down
2 changes: 0 additions & 2 deletions test/integration/options/parallel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('--parallel', function () {
it('should have the same result as with --no-parallel', async function () {
const expected = await runMochaAsync('options/parallel/test-*', [
'--no-parallel',
'--sort'
]);
return expect(
runMochaAsync('options/parallel/test-*', ['--parallel']),
Expand Down Expand Up @@ -303,7 +302,6 @@ describe('--parallel', function () {
'--reporter',
reporter,
'--no-parallel',
'--sort'
]);
return expect(
runMochaAsync('options/parallel/test-*', [
Expand Down

0 comments on commit bd50141

Please sign in to comment.