Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve execution context #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgrandrath
Copy link

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