ember/no-runloop
Would it be possible to improve the docs around ember/no-runloop?
- Fresh ember-cli apps use
@ember/runloopin instance initializer tests. - The readme talks about async cleanup, but there are so many more features in there, like
scheduleOnce('afterRender'...and,debounce, etc. - Its necessary to wrap code in
runin order forember/test-helperssetupOnerror/resetOnerrorto work.
Fresh ember-cli apps use @ember/runloop in instance initializer tests.
this is probably a bug and the tests should be updated :sweat_smile:
The readme talks about async cleanup, but there are so many more features in there,
like more alternatives to things you listed? I imagine it'd be a bit situational -- and in some cases not needed? but maybe having a few examples would be good -- more examples never hurts.
Its necessary to wrap code in run in order for ember/test-helpers setupOnerror/resetOnerror to work.
It is not
setupOnError can happen pre-visit, pre-render, and resetOnError, I usally do after every test so I don't forget about it.
https://github.com/NullVoxPopuli/limber/blob/main/apps/repl/tests/test-helper.ts#L22
Thanks :)
For this one:
Its necessary to wrap code in run in order for ember/test-helpers setupOnerror/resetOnerror to work.
https://github.com/emberjs/ember-test-helpers/issues/1128
In order for setupOnerror to work, the code that throws needs to be in a run.
if you don't want code in a run, you could use window.addEventListener('error'? perhaps?
using run at all is some api leakage :sweat_smile:
setupOnerror doesn't work with window.addEventListener though? Anyway, that's off topic. My point is, there are reasons to use the @ember/runloop (and therefore ignore the eslint warning). At this moment in time.