machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 155 forks source link

Docs recommend using a private Ember API for test cleanup #525

Open runspired opened 1 year ago

runspired commented 1 year ago

Ember.run.cancelTimers is not a public API but is recommended here: https://ember-concurrency.com/docs/testing-debugging

It's not even documented as a private API: https://api.emberjs.com/ember/release/modules/@ember%2Frunloop Nor is it documented as part of Backburner's API https://github.com/BackburnerJS/backburner.js/tree/master

RobbieTheWagner commented 1 year ago

@machty could we expose a test helper instead for this that would do something similar?

machty commented 1 year ago

I'm not sure what to recommend here; I don't think EC is alone in recommending use of cancelTimers, and lots of folk doing custom long-polling solutions are probably using cancelTimers. If there is some community convention surrounding this, I'm happy to recommend it.

RobbieTheWagner commented 1 year ago

Using run.foo is deprecated, and since this is not public API, I think we should probably at least wrap it in a test helper or something. Not sure if that shields us properly from the deprecation or not.