Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Release 1.7.0

TJ Holowaychuk42529ae3bcc1
diff --git a/History.md b/History.md
index af306a8d..b66bd6d2 100644
--- a/History.md
+++ b/History.md
@@ -1,4 +1,19 @@
+1.7.0 / 2012-11-07
+==================
+
+ * add `--async-only` support to prevent false positives for missing `done()`
+ * add sorting by filename in code coverage
+ * add HTML 5 doctype to browser template.
+ * add play button to html reporter to rerun a single test
+ * add `this.timeout(ms)` as Suite#timeout(ms). Closes #599
+ * update growl dependency to 1.6.x
+ * fix encoding of test-case ?grep. Closes #637
+ * fix unicode chars on windows
+ * fix dom globals in Opera/IE. Closes #243
+ * fix markdown reporter a tags
+ * fix `this.timeout("5s")` support
+
1.6.0 / 2012-10-02
==================
diff --git a/lib/reporters/base.js b/lib/reporters/base.js
index f716fd4a..ef9e270b 100644
--- a/lib/reporters/base.js
+++ b/lib/reporters/base.js
@@ -72,7 +72,7 @@ exports.symbols = {
};
// With node.js on Windows: use symbols available in terminal default fonts
-if (process && 'win32' == process.platform) {
+if ('win32' == process.platform) {
exports.symbols.ok = '\u221A';
exports.symbols.err = '\u00D7';
exports.symbols.dot = '.';
diff --git a/mocha.js b/mocha.js
index 7c564c3e..7bba730a 100644
--- a/mocha.js
+++ b/mocha.js
@@ -1403,6 +1403,23 @@ exports.colors = {
, 'diff removed': 41
};
+/**
+ * Default symbol map.
+ */
+
+exports.symbols = {
+ ok: '✔',
+ err: '✖',
+ dot: '․'
+};
+
+// With node.js on Windows: use symbols available in terminal default fonts
+if ('win32' == process.platform) {
+ exports.symbols.ok = '\u221A';
+ exports.symbols.err = '\u00D7';
+ exports.symbols.dot = '.';
+}
+
/**
* Color `str` with the given `type`,
* allowing colors to be disabled,
@@ -1619,7 +1636,7 @@ Base.prototype.epilogue = function(){
// failure
if (stats.failures) {
- fmt = color('bright fail', ' ✖')
+ fmt = color('bright fail', ' ' + exports.symbols.err)
+ color('fail', ' %d of %d %s failed')
+ color('light', ':')
@@ -1634,7 +1651,7 @@ Base.prototype.epilogue = function(){
}
// pass
- fmt = color('bright pass', ' ✔')
+ fmt = color('bright pass', ' ' + exports.symbols.ok)
+ color('green', ' %d %s complete')
+ color('light', ' (%s)');
@@ -1795,7 +1812,6 @@ function Dot(runner) {
var self = this
, stats = this.stats
, width = Base.window.width * .75 | 0
- , c = '․'
, n = 0;
runner.on('start', function(){
@@ -1803,21 +1819,21 @@ function Dot(runner) {
});
runner.on('pending', function(test){
- process.stdout.write(color('pending', c));
+ process.stdout.write(color('pending', Base.symbols.dot));
});
runner.on('pass', function(test){
if (++n % width == 0) process.stdout.write('\n ');
if ('slow' == test.speed) {
- process.stdout.write(color('bright yellow', c));
+ process.stdout.write(color('bright yellow', Base.symbols.dot));
} else {
- process.stdout.write(color(test.speed, c));
+ process.stdout.write(color(test.speed, Base.symbols.dot));
}
});
runner.on('fail', function(test, err){
if (++n % width == 0) process.stdout.write('\n ');
- process.stdout.write(color('fail', c));
+ process.stdout.write(color('fail', Base.symbols.dot));
});
runner.on('end', function(){
@@ -2254,6 +2270,10 @@ function map(cov) {
ret.sloc += data.sloc;
}
+ ret.files.sort(function(a, b) {
+ return a.filename.localeCompare(b.filename);
+ });
+
if (ret.sloc > 0) {
ret.coverage = (ret.hits / ret.sloc) * 100;
}
@@ -2608,7 +2628,7 @@ function List(runner) {
});
runner.on('pass', function(test){
- var fmt = color('checkmark', ' ✓')
+ var fmt = color('checkmark', ' '+Base.symbols.dot)
+ color('pass', ' %s: ')
+ color(test.speed, '%dms');
cursor.CR();
@@ -3080,7 +3100,7 @@ function Progress(runner, options) {
// default chars
options.open = options.open || '[';
options.complete = options.complete || '▬';
- options.incomplete = options.incomplete || '⋅';
+ options.incomplete = options.incomplete || Base.symbols.dot;
options.close = options.close || ']';
options.verbose = false;
@@ -3189,13 +3209,13 @@ function Spec(runner) {
runner.on('pass', function(test){
if ('fast' == test.speed) {
var fmt = indent()
- + color('checkmark', ' ✓')
+ + color('checkmark', ' ' + Base.symbols.ok)
+ color('pass', ' %s ');
cursor.CR();
console.log(fmt, test.title);
} else {
var fmt = indent()
- + color('checkmark', ' ✓')
+ + color('checkmark', ' ' + Base.symbols.ok)
+ color('pass', ' %s ')
+ color(test.speed, '(%dms)');
cursor.CR();
diff --git a/package.json b/package.json
index ad95195b..fdcb1aba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mocha"
- , "version": "1.6.0"
+ , "version": "1.7.0"
, "description": "simple, flexible, fun test framework"
, "keywords": ["test", "bdd", "tdd", "tap"]
, "author": "TJ Holowaychuk <[email protected]>"