Skip to content

Commit

Permalink
Update documentation concerning fs.readdir
Browse files Browse the repository at this point in the history
No order is implied via fs.readdir(). Different OS/filesystem combinations can give different results via readdir(3) which returns directory entries in traversal order (e.g., on macOS, HFS+ uses lexical order and APFS uses filename hash order).
  • Loading branch information
plroebuck committed Jan 5, 2019
1 parent cb1c6b0 commit 16100b9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function ignored(path) {
/**
* Lookup files in the given `dir`.
*
* @description
* Filenames are returned in _traversal_ order by the OS/filesystem.
* **Make no assumption that the names will be sorted in any fashion.**
*
* @private
* @param {string} dir
* @param {string[]} [ext=['.js']]
Expand Down Expand Up @@ -502,12 +506,16 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) {
/**
* Lookup file names at the given `path`.
*
* @memberof Mocha.utils
* @description
* Filenames are returned in _traversal_ order by the OS/filesystem.
* **Make no assumption that the names will be sorted in any fashion.**
*
* @public
* @param {string} filepath Base path to start searching from.
* @param {string[]} extensions File extensions to look for.
* @param {boolean} recursive Whether or not to recurse into subdirectories.
* @memberof Mocha.utils
* @todo Fix extension handling
* @param {string} filepath - Base path to start searching from.
* @param {string[]} extensions - File extensions to look for.
* @param {boolean} recursive - Whether to recurse into subdirectories.
* @return {string[]} An array of paths.
*/
exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
Expand Down

0 comments on commit 16100b9

Please sign in to comment.