utils

Mocha. utils

new utils()

Source:

Methods

(static) exports.lookupFiles(filepath, extensionsopt, recursiveopt) → {Array:.<string:>}

Source:

Filenames are returned in traversal order by the OS/filesystem.
Make no assumption that the names will be sorted in any fashion.

Parameters:
NameTypeAttributesDefaultDescription
filepathstring

Base path to start searching from.

extensionsArray:.<string:><optional>
[]

File extensions to look for.

recursiveboolean<optional>
false

Whether to recurse into subdirectories.

Throws:
  • if no files match pattern.

    Type
    Error
  • if filepath is directory and extensions not provided.

    Type
    TypeError
Returns:

An array of paths.

Type
Array:.<string:>