Permalink
Browse files

Release 0.8.2

  • Loading branch information...
1 parent fde99df commit 2a90cd4eb29242d1be4bb573b56c0f64e7dbd103 @tj tj committed Jan 5, 2012
Showing with 15 additions and 5 deletions.
  1. +7 −0 History.md
  2. +1 −1 lib/mocha.js
  3. +6 −3 mocha.js
  4. +1 −1 package.json
View
@@ -1,4 +1,11 @@
+0.8.2 / 2012-01-05
+==================
+
+ * Added test-case context support. Closes #113
+ * Fixed exit status. Closes #187
+ * Update commander. Closes #190
+
0.8.1 / 2011-12-30
==================
View
@@ -9,7 +9,7 @@
* Library version.
*/
-exports.version = '0.8.1';
+exports.version = '0.9.0';
exports.utils = require('./utils');
exports.interfaces = require('./interfaces');
View
@@ -688,7 +688,7 @@ require.register("mocha.js", function(module, exports, require){
* Library version.
*/
-exports.version = '0.8.1';
+exports.version = '0.9.0';
exports.utils = require('./utils');
exports.interfaces = require('./interfaces');
@@ -2015,6 +2015,7 @@ function Runnable(title, fn) {
this.async = fn && fn.length;
this.sync = ! this.async;
this._timeout = 2000;
+ this.context = this;
}
/**
@@ -2092,6 +2093,7 @@ Runnable.prototype.run = function(fn){
var self = this
, ms = this.timeout()
, start = new Date
+ , ctx = this.context
, finished
, emitted;
@@ -2126,7 +2128,7 @@ Runnable.prototype.run = function(fn){
// async
if (this.async) {
try {
- this.fn(function(err){
+ this.fn.call(ctx, function(err){
if (err instanceof Error) return done(err);
if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
done();
@@ -2139,7 +2141,7 @@ Runnable.prototype.run = function(fn){
// sync
try {
- if (!this.pending) this.fn();
+ if (!this.pending) this.fn.call(ctx);
this.duration = new Date - start;
fn();
} catch (err) {
@@ -2310,6 +2312,7 @@ Runner.prototype.hook = function(name, fn){
var hook = hooks[i];
if (!hook) return fn();
self.currentRunnable = hook;
+ hook.context = self.test;
self.emit('hook', hook);
View
@@ -1,6 +1,6 @@
{
"name": "mocha"
- , "version": "0.8.1"
+ , "version": "0.9.0"
, "description": "simple, flexible, fun test framework"
, "keywords": ["test", "bdd", "tdd", "tap"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"

0 comments on commit 2a90cd4

Please sign in to comment.