Comparing version 0.12.0 to 0.12.1
102
_mocha.js
@@ -387,2 +387,61 @@ | ||
require.register("context.js", function(module, exports, require){ | ||
/** | ||
* Expose `Context`. | ||
*/ | ||
module.exports = Context; | ||
/** | ||
* Initialize a new `Context`. | ||
* | ||
* @api private | ||
*/ | ||
function Context(){} | ||
/** | ||
* Set the context `Test` to `test`. | ||
* | ||
* @param {Test} test | ||
* @return {Context} | ||
* @api private | ||
*/ | ||
Context.prototype.test = function(test){ | ||
this._test = test; | ||
return this; | ||
}; | ||
/** | ||
* Set test timeout `ms`. | ||
* | ||
* @param {Number} ms | ||
* @return {Context} self | ||
* @api private | ||
*/ | ||
Context.prototype.timeout = function(ms){ | ||
this._test.timeout(ms); | ||
return this; | ||
}; | ||
/** | ||
* Inspect the context void of `._test`. | ||
* | ||
* @return {String} | ||
* @api private | ||
*/ | ||
Context.prototype.inspect = function(){ | ||
return JSON.stringify(this, function(key, val){ | ||
return '_test' == key | ||
? undefined | ||
: val; | ||
}, 2); | ||
}; | ||
}); // module: context.js | ||
require.register("hook.js", function(module, exports, require){ | ||
@@ -412,2 +471,3 @@ | ||
Runnable.call(this, title, fn); | ||
this.type = 'hook'; | ||
} | ||
@@ -792,3 +852,3 @@ | ||
exports.version = '0.12.0'; | ||
exports.version = '0.12.1'; | ||
@@ -799,2 +859,3 @@ exports.utils = require('./utils'); | ||
exports.Runnable = require('./runnable'); | ||
exports.Context = require('./context'); | ||
exports.Runner = require('./runner'); | ||
@@ -2122,3 +2183,2 @@ exports.Suite = require('./suite'); | ||
this.timedOut = false; | ||
this.context = this; | ||
} | ||
@@ -2202,3 +2262,3 @@ | ||
, start = new Date | ||
, ctx = this.context | ||
, ctx = this.ctx | ||
, finished | ||
@@ -2424,3 +2484,3 @@ , emitted; | ||
self.currentRunnable = hook; | ||
hook.context = self.test; | ||
hook.ctx.test(self.test); | ||
@@ -2534,2 +2594,3 @@ self.emit('hook', hook); | ||
try { | ||
test.ctx.test(test); | ||
test.on('error', function(err){ | ||
@@ -2734,3 +2795,3 @@ self.fail(test, err); | ||
exports.create = function(parent, title){ | ||
var suite = new Suite(title); | ||
var suite = new Suite(title, parent.ctx); | ||
suite.parent = parent; | ||
@@ -2743,10 +2804,13 @@ title = suite.fullTitle(); | ||
/** | ||
* Initialize a new `Suite` with the given `title`. | ||
* Initialize a new `Suite` with the given | ||
* `title` and `ctx`. | ||
* | ||
* @param {String} title | ||
* @param {Context} ctx | ||
* @api private | ||
*/ | ||
function Suite(title) { | ||
function Suite(title, ctx) { | ||
this.title = title; | ||
this.ctx = ctx; | ||
this.suites = []; | ||
@@ -2781,2 +2845,3 @@ this.tests = []; | ||
debug('clone'); | ||
suite.ctx = this.ctx; | ||
suite.timeout(this.timeout()); | ||
@@ -2830,2 +2895,3 @@ suite.bail(this.bail()); | ||
hook.timeout(this.timeout()); | ||
hook.ctx = this.ctx; | ||
this._beforeAll.push(hook); | ||
@@ -2848,2 +2914,3 @@ this.emit('beforeAll', hook); | ||
hook.timeout(this.timeout()); | ||
hook.ctx = this.ctx; | ||
this._afterAll.push(hook); | ||
@@ -2866,2 +2933,3 @@ this.emit('afterAll', hook); | ||
hook.timeout(this.timeout()); | ||
hook.ctx = this.ctx; | ||
this._beforeEach.push(hook); | ||
@@ -2884,2 +2952,3 @@ this.emit('beforeEach', hook); | ||
hook.timeout(this.timeout()); | ||
hook.ctx = this.ctx; | ||
this._afterEach.push(hook); | ||
@@ -2918,2 +2987,3 @@ this.emit('afterEach', hook); | ||
test.timeout(this.timeout()); | ||
test.ctx = this.ctx; | ||
this.tests.push(test); | ||
@@ -2991,2 +3061,18 @@ this.emit('test', test); | ||
/** | ||
* Inspect the context void of private properties. | ||
* | ||
* @return {String} | ||
* @api private | ||
*/ | ||
Test.prototype.inspect = function(){ | ||
return JSON.stringify(this, function(key, val){ | ||
return '_' == key[0] | ||
? undefined | ||
: 'parent' == key | ||
? '#<Suite>' | ||
: val; | ||
}, 2); | ||
}; | ||
}); // module: test.js | ||
@@ -3151,3 +3237,3 @@ | ||
* @return {Array} | ||
* @api public | ||
* @api private | ||
*/ | ||
@@ -3154,0 +3240,0 @@ |
0.12.1 / 2012-02-14 | ||
================== | ||
* Added `npm docs mocha` support [TooTallNate] | ||
* Added a `Context` object used for hook and test-case this. Closes #253 | ||
* Fixed `Suite#clone()` `.ctx` reference. Closes #262 | ||
0.12.0 / 2012-02-02 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.12.0'; | ||
exports.version = '0.12.1'; | ||
@@ -15,0 +15,0 @@ exports.utils = require('./utils'); |
@@ -77,2 +77,3 @@ | ||
debug('clone'); | ||
suite.ctx = this.ctx; | ||
suite.timeout(this.timeout()); | ||
@@ -79,0 +80,0 @@ suite.bail(this.bail()); |
@@ -157,3 +157,3 @@ | ||
* @return {Array} | ||
* @api public | ||
* @api private | ||
*/ | ||
@@ -160,0 +160,0 @@ |
{ | ||
"name": "mocha" | ||
, "version": "0.12.0" | ||
, "version": "0.12.1" | ||
, "description": "simple, flexible, fun test framework" | ||
, "keywords": ["test", "bdd", "tdd", "tap"] | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
, "repository": { "type": "git", "url": "git://github.com/visionmedia/mocha.git" } | ||
, "main": "index" | ||
@@ -15,3 +16,3 @@ , "bin": { "mocha": "./bin/mocha", "_mocha": "./bin/_mocha" } | ||
"commander": "0.5.x" | ||
, "growl": "1.4.x" | ||
, "growl": "1.5.x" | ||
, "debug": "*" | ||
@@ -18,0 +19,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
348925
9665
15
+ Addedgrowl@1.5.1(transitive)
- Removedgrowl@1.4.1(transitive)
Updatedgrowl@1.5.x