Skip to content

Commit

Permalink
Release 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 1, 2012
1 parent c44cf13 commit 3ed2a66
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
16 changes: 16 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@

1.3.1 / 2012-08-01
==================

* add passes/failures toggling to HTML reporter
* add pending state to `xit()` and `xdescribe()` [Brian Moore]
* add the @charset "UTF-8"; to fix #522 with FireFox. [Jonathan Creamer]
* add border-bottom to #stats links
* add check for runnable in `Runner#uncaught()`. Closes #494
* add 0.4 and 0.6 back to travis.yml
* add `-E, --growl-errors` to growl on failures only
* add prefixes to debug() names. Closes #497
* add `Mocha#invert()` to js api
* change dot reporter to use sexy unicode dots
* fix error when clicking pending test in HTML reporter
* fix `make tm`

1.3.0 / 2012-07-05
==================

Expand Down
50 changes: 34 additions & 16 deletions mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,6 @@ module.exports = function(suite){

suite.on('pre-require', function(context){

// pending variants

context.xdescribe = function(title, fn){
var suite = Suite.create(suites[0], title);
suite.pending = true;
suites.unshift(suite);
fn();
suites.shift();
};
context.xit = function(title){
context.it(title);
};

/**
* Execute before running tests.
*/
Expand Down Expand Up @@ -582,6 +569,18 @@ module.exports = function(suite){
suites[0].afterEach(fn);
};

/**
* Pending describe.
*/

context.xdescribe = context.xcontext = function(title, fn){
var suite = Suite.create(suites[0], title);
suite.pending = true;
suites.unshift(suite);
fn();
suites.shift();
};

/**
* Describe a "suite" with the given `title`
* and callback `fn` containing nested suites
Expand All @@ -602,8 +601,17 @@ module.exports = function(suite){
*/

context.it = context.specify = function(title, fn){
if (suites[0].pending) var fn = undefined;
suites[0].addTest(new Test(title, fn));
var suite = suites[0];
if (suite.pending) var fn = null;
suite.addTest(new Test(title, fn));
};

/**
* Pending test case.
*/

context.xit = context.xspecify = function(title){
context.it(title);
};
});
};
Expand Down Expand Up @@ -3128,7 +3136,11 @@ function XUnit(runner) {
, tests = []
, self = this;

runner.on('test end', function(test){
runner.on('pass', function(test){
tests.push(test);
});

runner.on('fail', function(test){
tests.push(test);
});

Expand Down Expand Up @@ -3928,6 +3940,7 @@ exports = module.exports = Suite;
exports.create = function(parent, title){
var suite = new Suite(title, parent.ctx);
suite.parent = parent;
if (parent.pending) suite.pending = true;
title = suite.fullTitle();
parent.addSuite(suite);
return suite;
Expand All @@ -3947,6 +3960,7 @@ function Suite(title, ctx) {
this.ctx = ctx;
this.suites = [];
this.tests = [];
this.pending = false;
this._beforeEach = [];
this._beforeAll = [];
this._afterEach = [];
Expand Down Expand Up @@ -4020,6 +4034,7 @@ Suite.prototype.bail = function(bail){
*/

Suite.prototype.beforeAll = function(fn){
if (this.pending) return this;
var hook = new Hook('"before all" hook', fn);
hook.parent = this;
hook.timeout(this.timeout());
Expand All @@ -4038,6 +4053,7 @@ Suite.prototype.beforeAll = function(fn){
*/

Suite.prototype.afterAll = function(fn){
if (this.pending) return this;
var hook = new Hook('"after all" hook', fn);
hook.parent = this;
hook.timeout(this.timeout());
Expand All @@ -4056,6 +4072,7 @@ Suite.prototype.afterAll = function(fn){
*/

Suite.prototype.beforeEach = function(fn){
if (this.pending) return this;
var hook = new Hook('"before each" hook', fn);
hook.parent = this;
hook.timeout(this.timeout());
Expand All @@ -4074,6 +4091,7 @@ Suite.prototype.beforeEach = function(fn){
*/

Suite.prototype.afterEach = function(fn){
if (this.pending) return this;
var hook = new Hook('"after each" hook', fn);
hook.parent = this;
hook.timeout(this.timeout());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mocha"
, "version": "1.3.0"
, "version": "1.3.1"
, "description": "simple, flexible, fun test framework"
, "keywords": ["test", "bdd", "tdd", "tap"]
, "author": "TJ Holowaychuk <[email protected]>"
Expand Down

0 comments on commit 3ed2a66

Please sign in to comment.