Permalink
Browse files

Fixed support for mocha 0.12.

  • Loading branch information...
lightsofapollo committed Feb 18, 2012
1 parent 4021e0a commit 54b44ead343488ec2d910df74ae1f409f34791cf
Showing with 16 additions and 7 deletions.
  1. +1 −1 Makefile
  2. +1 −0 lib/mocha-hooks.js
  3. +3 −3 package.json
  4. +10 −2 spec/mocha-hooks-spec.js
  5. +1 −1 watchr.js
View
@@ -1,2 +1,2 @@
test::
- mocha --require $(PWD)/spec/helper.js --reporter spec spec/*.js
+ ./node_modules/mocha/bin/mocha --require ./spec/helper.js --reporter spec spec/*.js
View
@@ -37,6 +37,7 @@ MochaHooks = {
});
beforeEachHook.parent = suite;
+ beforeEachHook.ctx = suite.ctx;
beforeEachHook.timeout(suite.timeout());
suite._beforeEach.unshift(beforeEachHook);
View
@@ -1,20 +1,20 @@
{
"name": "sinon-mocha",
- "version": "0.0.1",
+ "version": "0.0.2",
"author": "James Lal <james@lightsofapollo.com>",
"description": "Automatic restore for spies & mocks for mocha",
"main": "./lib/sinon-mocha",
"repository": {
"type": "git",
- "url": "https://github.com/lightsofapollo/node-sinon-mocha.git"
+ "url": "https://github.com/lightsofapollo/sinon-mocha/"
},
"keywords": [
"spec",
"mocha",
"sinon"
],
"devDependencies": {
- "mocha" : "*",
+ "mocha" : "~0.12",
"expect.js" : "*",
"sinon": "~1.3"
},
View
@@ -25,15 +25,23 @@ describe("mocha", function(){
return function(){};
};
+ function getTitle(ctx){
+ if(ctx._test){
+ return ctx._test.title;
+ } else {
+ return ctx.title;
+ }
+ }
+
before(function(){
hooks = [];
Hooks.beforeEach(function(){
- hooks.push('before - ' + this.title);
+ hooks.push('before - ' + getTitle(this));
});
Hooks.afterEach(function(){
- hooks.push('after - ' + this.title);
+ hooks.push('after - ' + getTitle(this));
});
});
View
@@ -4,7 +4,7 @@ var Projstrap = require('projstrap'),
//Command to run tests (change this to whatever you use)
specHelper = __dirname + '/spec/helper.js',
- cmd = 'mocha --require ' + specHelper + ' --growl -c --reporter spec ',
+ cmd = './node_modules/mocha/bin/mocha --require ' + specHelper + ' --growl -c --reporter spec ',
watchr,
suite;

0 comments on commit 54b44ea

Please sign in to comment.