Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Added exports.slow to tweak what is considered "slow"

Tj Holowaychuk4c8c1cf93f4b
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index 9514175b..0dc2b92d 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -84,6 +84,13 @@ exports.cursor = {
}
};
+/**
+ * A test is considered slow if it
+ * exceeds the following value in milliseconds.
+ */
+
+exports.slow = 75;
+
/**
* Outut the given `failures` as a list.
*
@@ -145,12 +152,14 @@ function Base(runner) {
runner.on('pass', function(test){
stats.passes = stats.passes || 0;
- // TODO: configurable
- test.speed = test.duration < 20
- ? 'fast'
- : test.duration < 75
+
+ var medium = exports.slow / 2;
+ test.speed = test.duration > exports.slow
+ ? 'slow'
+ : test.duration > medium
? 'medium'
- : 'slow';
+ : 'fast';
+
stats.passes++;
});