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

flush(callback) method does not work with sinon.useFakeTimers #2928

Closed
oderby opened this issue Apr 19, 2015 · 1 comment
Closed

flush(callback) method does not work with sinon.useFakeTimers #2928

oderby opened this issue Apr 19, 2015 · 1 comment

Comments

@oderby
Copy link

oderby commented Apr 19, 2015

I'm guessing because it just assumes no one mucks with the global setTimeout methods. In particular, running the following using wct

suite('AwesomeLib', function() {
  this.timeout(1000);
  setup(function() {
    this.clock = sinon.useFakeTimers();
  });
  teardown(function() {
    this.clock.restore();
  });
  test('is awesome', function(done) {
    // ... assume we do something async here.
    flush(function() {
      assert.isTrue(true);
      done();
    });
  });
});

results in mocha failing the test with error "timeout of 1000ms exceeded".

Perhaps the fix is to do something like what Mocha did (capture the desired global timer methods): mochajs/mocha#237

@nevir
Copy link
Contributor

nevir commented Apr 27, 2015

Ugh, good catch! Yeah, I'll keep a reference around to the original timers

@aomarks aomarks transferred this issue from Polymer/web-component-tester Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants