danielstjules/mocha.parallel

Context of `parallel`?

amilajack opened this issue · 6 comments

parallel seems to have an unusual context. For example:

// test.js

parallel('Some test', function () {
  this.slow(2000)
})

would return:

Cannot read property 'slow' of undefined

It seems as if the context of parallel is not the function.

Somewhat related to #5 (comment) This may not be a problem in the latest mocha, so I'll need to test if a solution is available to this issue :)

Maybe test cases should be added to check for this. What do you think?

Fixed by #17 :)

Fixed and published in 0.13!

Great! I'll try testing this out.

Should we open a new issue for properly supporting all the context assigned props, or should we re-open this one (since the issue title is covering a wider range of things to support)?
Eg:

describe('a', function() {

  before(function() {
    this.x = 1;
  });

  parallel('b', function() {

    before(function() {
      this.x = 2;
    });

    it('c', function() {
      console.log(this.x); // undefined
    });
  });
});