diff --git a/lib/contextProxy.js b/lib/contextProxy.js index 3fc4ec1..2c62248 100644 --- a/lib/contextProxy.js +++ b/lib/contextProxy.js @@ -4,7 +4,7 @@ * @param {Spec} [spec] */ function ContextProxy(spec) { - this.spec = spec; + this.spec = spec || {}; this.config = {}; } diff --git a/lib/parallel.js b/lib/parallel.js index fc6be65..0ef9469 100644 --- a/lib/parallel.js +++ b/lib/parallel.js @@ -223,6 +223,13 @@ function patchIt(specs) { var spec = { name: name, + title: name, + titlePath: function() { + return this.title; + }, + fullTitle: function() { + return this.title; + }, getPromise: function() { var start = Date.now(); return createWrapper(fn, spec.ctx)().then(function(duration) { diff --git a/package.json b/package.json index 5fb381e..5bd2791 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mocha.parallel", - "version": "0.15.6", + "version": "0.15.7", "description": "Run async mocha specs in parallel", "main": "lib/parallel.js", "scripts": { diff --git a/spec/fixtures/contextProxy.js b/spec/fixtures/contextProxy.js index 65f2e54..bfe1a00 100644 --- a/spec/fixtures/contextProxy.js +++ b/spec/fixtures/contextProxy.js @@ -23,4 +23,12 @@ parallel('suite', function() { it('test4', function(done) { setTimeout(done, 2500); }); + + it('test5', function(done) { + assert.strictEqual('test5', this.spec.title); + assert.strictEqual('test5', this.spec.fullTitle()); + assert.strictEqual('test5', this.spec.name); + assert.strictEqual('test5', this.spec.titlePath()); + done(); + }); }); diff --git a/spec/spec.js b/spec/spec.js index 29c1495..3c72218 100644 --- a/spec/spec.js +++ b/spec/spec.js @@ -259,12 +259,13 @@ describe('parallel', function() { stdout = stdout.replace(/\n\s+/g, ' '); // remove new lines assert(err); assert(!stderr.length); - assert(stdout.indexOf('2 passing') !== -1); + assert(stdout.indexOf('3 passing') !== -1); assert(stdout.indexOf('1 pending') !== -1); assert(stdout.indexOf('1 failing') !== -1); assert(stdout.indexOf('1) suite test1:') !== -1); assert(stdout.indexOf('timeout of 100ms exceeded') !== -1); + done(); }); });