Open amk221 opened 10 months ago
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.
Would it be possible to improve the docs around
ember/no-runloop
?@ember/runloop
in instance initializer tests.scheduleOnce('afterRender'...
and,debounce
, etc.run
in order forember/test-helpers
setupOnerror/resetOnerror
to work.