lozjackson / ember-clock

Clock service for Ember
http://lozjackson.github.io/ember-clock
MIT License
8 stars 5 forks source link

Addon prevents acceptance tests from running #1

Closed Sinled closed 8 years ago

Sinled commented 8 years ago

hi, i have an issue with this addon,

it results timeout in acceptance test, as far as i understand the problem in this part of code

tick() {
      this.setTime();
      this.set('nextTick', run.later(this, () => {
      this.tick ();
    }, 1000));
},

any ideas how to avoid this? Call clock.stop() in every test?

lozjackson commented 8 years ago

Hi, I'm pleased to hear you are using the addon, but sorry to hear you are having issues with it.. Thanks for reporting the issue.

I'm fairly busy until middle of next week, but I'm keen to help where I can and try and resolve the issue.

I'm not fully understanding the problem though - if you could explain the problem with a little more detail, and if possible a failing test that I can look at, that would be great..

...and if you wanted to try a fix yourself and do a PR, that would be even better..

lozjackson commented 8 years ago

I've had a look today.. and all the solutions I can come with involve mocking the service in one way or another while testing.

Do you need the clock in your test?

Sinled commented 8 years ago

@lozjackson thanks for reply

Do you need the clock in your test?

No. Currently i ended up with disabling it in beforeEach hook in module-for-acceptance helper

        beforeEach() {
            this.application = startApp();

            // don't run clock service in acceptance test
            const clockService = this.application.__container__.lookup('service:clock');
            if (clockService) { clockService.stop(); }

            if (options.beforeEach) {
                return options.beforeEach(...arguments);
            }
        },
lozjackson commented 8 years ago

ok.. thanks for the feedback.

nadnoslen commented 4 years ago

Oh my goodness. Thank you @Sinled for raising this ticket. I was pulling my hair out trying to figure out why my ember-qunit tests were blocked from running! Cheers!🍺