Comparing version 5.0.3 to 5.0.4
@@ -11,4 +11,11 @@ 'use strict'; | ||
var path = require('path'); | ||
var join = path.join; | ||
var he = require('he'); | ||
/** | ||
* Ignored directories. | ||
*/ | ||
var ignore = ['node_modules', '.git']; | ||
exports.inherits = require('util').inherits; | ||
@@ -59,2 +66,42 @@ | ||
/** | ||
* Ignored files. | ||
* | ||
* @api private | ||
* @param {string} path | ||
* @return {boolean} | ||
*/ | ||
function ignored (path) { | ||
return !~ignore.indexOf(path); | ||
} | ||
/** | ||
* Lookup files in the given `dir`. | ||
* | ||
* @api private | ||
* @param {string} dir | ||
* @param {string[]} [ext=['.js']] | ||
* @param {Array} [ret=[]] | ||
* @return {Array} | ||
*/ | ||
exports.files = function (dir, ext, ret) { | ||
ret = ret || []; | ||
ext = ext || ['js']; | ||
var re = new RegExp('\\.(' + ext.join('|') + ')$'); | ||
fs.readdirSync(dir) | ||
.filter(ignored) | ||
.forEach(function (path) { | ||
path = join(dir, path); | ||
if (fs.lstatSync(path).isDirectory()) { | ||
exports.files(path, ext, ret); | ||
} else if (path.match(re)) { | ||
ret.push(path); | ||
} | ||
}); | ||
return ret; | ||
}; | ||
/** | ||
* Compute a slug from the given `str`. | ||
@@ -61,0 +108,0 @@ * |
{ | ||
"name": "mocha", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "simple, flexible, fun test framework", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
852246
19212