diff --git a/lib/utils.js b/lib/utils.js index 85fa657593..c637648442 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -13,6 +13,7 @@ var debug = require('debug')('mocha:watch'); var fs = require('fs'); var glob = require('glob'); var path = require('path'); +var util = require('util'); var join = path.join; var he = require('he'); var errors = require('./errors'); @@ -531,7 +532,7 @@ exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) { files = glob.sync(filepath); if (!files.length) { throw createNoFilesMatchPatternError( - 'Cannot find any files matching pattern "' + filepath + '"', + 'Cannot find any files matching pattern ' + exports.dQuote(filepath), filepath ); } @@ -565,7 +566,11 @@ exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) { } if (!extensions) { throw createMissingArgumentError( - 'Argument "extensions" required when argument "filepath" is a directory', + util.format( + 'Argument %s required when argument %s is a directory', + exports.sQuote('extensions'), + exports.sQuote('filepath') + ), 'extensions', 'array' ); @@ -763,7 +768,7 @@ exports.sQuote = function(str) { * * @description * Provides a simple means of markup for quoting text to be used in output. - * Use this to quote names of datatypes, classes, and strings. + * Use this to quote names of datatypes, classes, pathnames, and strings. * * argument 'value' must be "string" or "number" *