feat: bumped glob dependency from 8 to 10#5250
Conversation
| // 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')) |
There was a problem hiding this comment.
This was "fun" to debug. The order of tests is different with the newer version of glob.
From npx mocha "test/integration/fixtures/options/parallel/test-*":
main:a,b,c,dglob-10:d,c,b,a
This is isaacs/node-glob#576: that it's determined by OS latency. glob@8 used to sort (https://github.com/isaacs/node-glob/blob/v8.1.0/common.js#L20).
|
Seems like there are still ways to go for upgrading glob: I tried to test this branch with https://github.com/Tyriar/vscode-sort-lines, but unfortunately @vscode/test-electron (2.4.1) doesn't work with |
Yeah, the internal dependencies for this repo have a ways to go 🥲. A lot of them come from the very old docs website setup we have. It's going to be a bit more till we internally are clean & up to date. Tracked in #5207. |
* feat: bumped glob dependency from 8 to 10 * feat: bumped glob dependency from 8 to 10 * test: add --sort to --no-parallel tests * Switch from --sort in tests to preserving glob@8 sorting * Update glob sorting comment link * revert parallel.spec.js changes
PR Checklist
status: accepting prsOverview
Bumps the
globversion range inpackage.json. We can't yet useglob@11, as it only supports Node.js 20 up and Mocha 11 still supports Node.js 18.The only change to JS source code is a manual
'en'alphabetical sort ofglob.syncresults. This is to preserve the legacy behavior of what order test files are found and run: https://github.com/mochajs/mocha/pull/5250/files#r1840469747.I tested this on the https://github.com/eslint/eslint and https://github.com/Microsoft/TypeScript projects and all tests reported passing.