mitchlloyd / ember-screen

A screen size service for Ember
MIT License
50 stars 10 forks source link

Ensure default value set during tests #4

Closed samselikoff closed 2 years ago

samselikoff commented 7 years ago

We just got bit because tests were passing on an external monitor and failing on laptop, took us a while to figure out why.

I think the addon should warn/throw if you haven't set a default value for your tests.

mitchlloyd commented 7 years ago

I'm imagining a scenario where someone installs this addon to handle a small use case in their app, and suddenly all of their tests are failing or the console is filled with warnings. That would probably make me uninstall that addon. As it is now, the situation is no worse than running tests without the addon installed.

Would it be better to document and encourage people to add defaults to their moduleForAcceptance function? Maybe there could be some configuration in config/environments.js that turns on requireStubMediaFeatures.

samselikoff commented 7 years ago

We could also do an in-memory default of desktop and print a warning/message when running tests that "No default is set, please specify an explicit size in config/environment"

samselikoff commented 7 years ago

Also if you add this addon, the only tests that could start failing would be ones that somehow touch this addon's service right? In that case a failure could be ok