Skip to content

Preserve execution context#8

Open
mgrandrath wants to merge 1 commit intomxriverlynn:masterfrom
mgrandrath:patch-1
Open

Preserve execution context#8
mgrandrath wants to merge 1 commit intomxriverlynn:masterfrom
mgrandrath:patch-1

Conversation

@mgrandrath
Copy link
Copy Markdown

This change preserves the execution context in functions passed to async.beforeEach etc. so that the following code works:

describe("something", function () {
  var async = new Async(this);

  async.beforeEach(function (done) {
    var self = this;
    doSomethingAsync(function (asyncResult) {
      self.result = asyncResult;
      done();
    });
  });

  it("is ready", function () {
    expect(this.result).toBeDefined();
  });
});

This change preserves the execution context in functions passed to async.beforeEach etc. so that the following code works:

```javascript
describe("something", function () {
  var async = new Async(this);

  async.beforeEach(function (done) {
    var self = this;
    doSomethingAsync(function (asyncResult) {
      self.result = asyncResult;
      done();
    });
  });

  it("is ready", function () {
    expect(this.result).toBeDefined();
  });
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant