src/lib/bin.js
/**
 * Recursively load a file/directory tests as a tree into memory.
 * @param {string} path Path to a test suite
 */
Recursively load a file/directory tests as a tree into memory.
@param {string} path Path to a test suite
Recursively load a file / directory tests as a tree into memory . @param { string } path Path to a test suite
async function requireTests(path) {
  try {
    const res =  (await makePromise(lstat, path))
    if (res.isFile()) {
      const p = resolve(path)
      const tests = require(p)
      return tests
    } else if (res.isDirectory()) {
      const dir = await buildDirectory(path)
      return dir
    }
  } catch (err) {
    const m = c('Could not require ', 'red') + b(c(path, 'white'), 'red')
    err.message += `\n${m}`
    throw err
  }
}
async function requireTests ( path ) { try { const res = ( await makePromise ( lstat , path ) ) if ( res . isFile ( ) ) { const p = resolve ( path ) const tests = require ( p ) return tests } else if ( res . isDirectory ( ) ) { const dir = await buildDirectory ( path ) return dir } } catch ( err ) { const m = c ( 'Could not require ' , 'red' ) + b ( c ( path , 'white' ) , 'red' ) err . message += ` \n ${ m } ` throw err } }
Recursively load a file/directory tests as a tree into memory.
Recursively load a file / directory tests as a tree into memory .
/** @type {fs.Stats} */ // file or directory does not exist