Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed support for mocha 0.12.

  • Loading branch information...
commit 54b44ead343488ec2d910df74ae1f409f34791cf 1 parent 4021e0a
James Lal authored
2  Makefile
... ... @@ -1,2 +1,2 @@
1 1 test::
2   - mocha --require $(PWD)/spec/helper.js --reporter spec spec/*.js
  2 + ./node_modules/mocha/bin/mocha --require ./spec/helper.js --reporter spec spec/*.js
1  lib/mocha-hooks.js
@@ -37,6 +37,7 @@ MochaHooks = {
37 37 });
38 38
39 39 beforeEachHook.parent = suite;
  40 + beforeEachHook.ctx = suite.ctx;
40 41 beforeEachHook.timeout(suite.timeout());
41 42 suite._beforeEach.unshift(beforeEachHook);
42 43
6 package.json
... ... @@ -1,12 +1,12 @@
1 1 {
2 2 "name": "sinon-mocha",
3   - "version": "0.0.1",
  3 + "version": "0.0.2",
4 4 "author": "James Lal <james@lightsofapollo.com>",
5 5 "description": "Automatic restore for spies & mocks for mocha",
6 6 "main": "./lib/sinon-mocha",
7 7 "repository": {
8 8 "type": "git",
9   - "url": "https://github.com/lightsofapollo/node-sinon-mocha.git"
  9 + "url": "https://github.com/lightsofapollo/sinon-mocha/"
10 10 },
11 11 "keywords": [
12 12 "spec",
@@ -14,7 +14,7 @@
14 14 "sinon"
15 15 ],
16 16 "devDependencies": {
17   - "mocha" : "*",
  17 + "mocha" : "~0.12",
18 18 "expect.js" : "*",
19 19 "sinon": "~1.3"
20 20 },
12 spec/mocha-hooks-spec.js
@@ -25,15 +25,23 @@ describe("mocha", function(){
25 25 return function(){};
26 26 };
27 27
  28 + function getTitle(ctx){
  29 + if(ctx._test){
  30 + return ctx._test.title;
  31 + } else {
  32 + return ctx.title;
  33 + }
  34 + }
  35 +
28 36 before(function(){
29 37
30 38 hooks = [];
31 39 Hooks.beforeEach(function(){
32   - hooks.push('before - ' + this.title);
  40 + hooks.push('before - ' + getTitle(this));
33 41 });
34 42
35 43 Hooks.afterEach(function(){
36   - hooks.push('after - ' + this.title);
  44 + hooks.push('after - ' + getTitle(this));
37 45 });
38 46 });
39 47
2  watchr.js
@@ -4,7 +4,7 @@ var Projstrap = require('projstrap'),
4 4
5 5 //Command to run tests (change this to whatever you use)
6 6 specHelper = __dirname + '/spec/helper.js',
7   - cmd = 'mocha --require ' + specHelper + ' --growl -c --reporter spec ',
  7 + cmd = './node_modules/mocha/bin/mocha --require ' + specHelper + ' --growl -c --reporter spec ',
8 8 watchr,
9 9 suite;
10 10

0 comments on commit 54b44ea

Please sign in to comment.
Something went wrong with that request. Please try again.