☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added --timeout second shorthand support.
Tj Holowaychuk8c2d06c48603
diff --git a/bin/mocha b/bin/mochaindex c162ad84..e4730ead 100755--- a/bin/mocha+++ b/bin/mocha@@ -32,7 +32,7 @@ program.option('-R, --reporter <name>', 'specify the reporter to use', 'dot').option('-u, --ui <name>', 'specify user-interface (bdd|tdd|exports)', 'bdd').option('-g, --grep <pattern>', 'only run tests matching <pattern>')- .option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]', parseInt)+ .option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]').option('-s, --slow <ms>', '"slow" test threshold in milliseconds [75]', parseInt).option('-G, --growl', 'enable growl support')diff --git a/lib/suite.js b/lib/suite.jsindex 719beec2..827ba352 100644--- a/lib/suite.js+++ b/lib/suite.js@@ -64,15 +64,16 @@ function Suite(title) {Suite.prototype.__proto__ = EventEmitter.prototype;/**- * Set timeout `ms`.+ * Set timeout `ms` or short-hand such as "2s".*- * @param {Number} ms+ * @param {Number|String} ms* @return {Suite} for chaining* @api private*/Suite.prototype.timeout = function(ms){- this._timeout = ms;+ if (String(ms).match(/s$/)) ms = parseFloat(ms) * 1000;+ this._timeout = parseInt(ms, 10);return this;};