Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Release 0.7.1

  • Loading branch information...
commit c9935e7c168afb2ebb2cebf6f161f842b8677295 1 parent 95c95e8
@tj tj authored
Showing with 52 additions and 23 deletions.
  1. +9 −0 History.md
  2. +1 −1  lib/mocha.js
  3. +41 −21 mocha.js
  4. +1 −1  package.json
View
9 History.md
@@ -1,4 +1,13 @@
+0.7.1 / 2011-12-22
+==================
+
+ * Removed `mocha-debug(1)`, use `mocha --debug`
+ * Fixed CWD relative requires
+ * Fixed growl issue on windows [Raynos]
+ * Fixed: platform specific line endings [TooTallNate]
+ * Fixed: escape strings in HTML reporter. Closes #164
+
0.7.0 / 2011-12-18
==================
View
2  lib/mocha.js
@@ -9,7 +9,7 @@
* Library version.
*/
-exports.version = '0.7.0';
+exports.version = '0.7.1';
exports.utils = require('./utils');
exports.interfaces = require('./interfaces');
View
62 mocha.js
@@ -793,6 +793,19 @@ exports.cursor = {
show: function(){
process.stdout.write('\033[?25h');
+ },
+
+ deleteLine: function(){
+ process.stdout.write('\033[2K');
+ },
+
+ beginningOfLine: function(){
+ process.stdout.write('\033[0G');
+ },
+
+ CR: function(){
+ exports.cursor.deleteLine();
+ exports.cursor.beginningOfLine();
}
};
@@ -1081,7 +1094,8 @@ require.register("reporters/html.js", function(module, exports, require){
var Base = require('./base')
, utils = require('../utils')
- , Progress = require('../browser/progress');
+ , Progress = require('../browser/progress')
+ , escape = utils.escape;
/**
* Expose `Doc`.
@@ -1119,7 +1133,8 @@ function HTML(runner) {
, stack = [root]
, stat = $(statsTemplate).appendTo(root)
, canvas = stat.find('canvas').get(0)
- , ctx, progress
+ , progress
+ , ctx
if (canvas.getContext) {
ctx = canvas.getContext('2d');
@@ -1128,9 +1143,7 @@ function HTML(runner) {
if (!root.length) return error('#mocha div missing, add it to your document');
- if (progress) {
- progress.size(50);
- }
+ if (progress) progress.size(50);
runner.on('suite', function(suite){
if (suite.root) return;
@@ -1158,7 +1171,6 @@ function HTML(runner) {
var percent = stats.tests / total * 100 | 0;
if (progress) {
- // update progress bar
progress.update(percent).draw(ctx);
}
@@ -1170,21 +1182,18 @@ function HTML(runner) {
// test
if (test.passed) {
- var el = $('<div class="test pass"><h2>' + test.title + '</h2></div>')
+ var el = $('<div class="test pass"><h2>' + escape(test.title) + '</h2></div>')
} else if (test.pending) {
- var el = $('<div class="test pass pending"><h2>' + test.title + '</h2></div>')
+ var el = $('<div class="test pass pending"><h2>' + escape(test.title) + '</h2></div>')
} else {
- var el = $('<div class="test fail"><h2>' + test.title + '</h2></div>');
+ var el = $('<div class="test fail"><h2>' + escape(test.title) + '</h2></div>');
var str = test.err.stack || test.err;
// <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
// check for the result of the stringifying.
- if ('[object Error]' == str) {
- str = test.err.message;
- }
+ if ('[object Error]' == str) str = test.err.message;
- var err = $('<pre class="error">' + str + '</pre>');
- el.append(err);
+ $('<pre class="error">' + escape(str) + '</pre>').appendTo(el);
}
// toggle code
@@ -1197,7 +1206,7 @@ function HTML(runner) {
// code
// TODO: defer
if (!test.pending) {
- var code = utils.escape(clean(test.fn.toString()));
+ var code = escape(clean(test.fn.toString()));
var pre = $('<pre><code>' + code + '</code></pre>');
pre.appendTo(el).hide();
}
@@ -1493,6 +1502,7 @@ require.register("reporters/list.js", function(module, exports, require){
*/
var Base = require('./base')
+ , cursor = Base.cursor
, color = Base.color;
/**
@@ -1533,11 +1543,13 @@ function List(runner) {
var fmt = color('checkmark', '')
+ color('pass', ' %s: ')
+ color(test.speed, '%dms');
- console.log('\r' + fmt, test.fullTitle(), test.duration);
+ cursor.CR();
+ console.log(fmt, test.fullTitle(), test.duration);
});
runner.on('fail', function(test, err){
- console.log('\r' + color('fail', ' %d) %s'), n++, test.fullTitle());
+ cursor.CR();
+ console.log(color('fail', ' %d) %s'), n++, test.fullTitle());
});
runner.on('end', self.epilogue.bind(self));
@@ -1550,6 +1562,7 @@ function List(runner) {
List.prototype = new Base;
List.prototype.constructor = List;
+
}); // module: reporters/list.js
require.register("reporters/progress.js", function(module, exports, require){
@@ -1613,7 +1626,8 @@ function Progress(runner, options) {
, n = width * percent | 0
, i = width - n;
- process.stdout.write('\r\033[J');
+ cursor.CR();
+ process.stdout.write('\033[J');
process.stdout.write(color('progress', ' ' + options.open));
process.stdout.write(Array(n).join(options.complete));
process.stdout.write(Array(i).join(options.incomplete));
@@ -1639,6 +1653,7 @@ function Progress(runner, options) {
Progress.prototype = new Base;
Progress.prototype.constructor = Progress;
+
}); // module: reporters/progress.js
require.register("reporters/spec.js", function(module, exports, require){
@@ -1648,6 +1663,7 @@ require.register("reporters/spec.js", function(module, exports, require){
*/
var Base = require('./base')
+ , cursor = Base.cursor
, color = Base.color;
/**
@@ -1703,18 +1719,21 @@ function Spec(runner) {
var fmt = indent()
+ color('checkmark', '')
+ color('pass', ' %s ');
- console.log('\r' + fmt, test.title);
+ cursor.CR();
+ console.log(fmt, test.title);
} else {
var fmt = indent()
+ color('checkmark', '')
+ color('pass', ' %s ')
+ color(test.speed, '(%dms)');
- console.log('\r' + fmt, test.title, test.duration);
+ cursor.CR();
+ console.log(fmt, test.title, test.duration);
}
});
runner.on('fail', function(test, err){
- console.log('\r' + indent() + color('fail', ' %d) %s'), n++, test.title);
+ cursor.CR();
+ console.log(indent() + color('fail', ' %d) %s'), n++, test.title);
});
runner.on('end', self.epilogue.bind(self));
@@ -1727,6 +1746,7 @@ function Spec(runner) {
Spec.prototype = new Base;
Spec.prototype.constructor = Spec;
+
}); // module: reporters/spec.js
require.register("reporters/tap.js", function(module, exports, require){
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "mocha"
- , "version": "0.7.0"
+ , "version": "0.7.1"
, "description": "simple, flexible, fun test framework"
, "keywords": ["test", "bdd", "tdd", "tap"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
Please sign in to comment.
Something went wrong with that request. Please try again.