firefox-devtools / profiler

Firefox Profiler — Web app for Firefox performance analysis
https://profiler.firefox.com
Mozilla Public License 2.0
1.2k stars 391 forks source link

Re-organize fixtures and util functions in tests. #862

Open gregtatum opened 6 years ago

gregtatum commented 6 years ago

Right now everything is shoved in fixtures. Perhaps we could organize them better with src/test/utils/ and maybe re-organize things to be more consolidated in files. It feels really messy right now on how we organize and store things.

┆Issue is synchronized with this Jira Task

zoepage commented 6 years ago

Could you give a bit more context here? I was going through the tests today and was thinking about tackling this soon. :)

gregtatum commented 6 years ago

Looking at this, I think some of the clean-up may already have happened since I filed this. The biggest thing I think would be to rename src/test/fixtures to src/test/utils so that it's more accurate.

It could be nice to separate out utils for creating profiles from fixtures of profiles that look a certain way. I'm not sure if everything could be treated that way, but it may make the folder clearer in how it works. For instance the following files all seem to contain some kind of fixture.

The could be reorganized into:

It would also be nice to have a short bit of documentation on each fixture explaining what test it goes to and why it exists. These fixtures have been created in a really ad hoc way, so they may not be completely logical in how they are organized and used at this point. It may involve some best guesses to figure out if that fixture makes sense still.

Finally, src/test/utils/profiles/make-profile.js has turned into the most useful collection of utils for working with tests. I don't know if you have any ideas on making that file easier to understand and use. It's grown quite a bit with lots of functions at this point. I think originally Julien suggested naming the file src/test/utils/profiles/index.js so that it was the default thing you grab from the profiles folder.

Those are some of my general thoughts in the area, although at this point I do think we are in a much better place than when I first filed this.