There are several modules that do the following:
- locate available browsers on the current machine;
- do something with that information.
Usually #2 is "launch the browser with some specific content", but not always.
The modules I have in mind (of course there may be more!) are:
What I noticed is that each of these modules hosts a similar set of information about how to find browsers and parse versions on different platforms. See:
- https://github.com/airportyh/testem/blob/master/lib/browser_launcher.js
- https://github.com/substack/browser-launcher/tree/master/lib
- https://github.com/ekryski/launchpad/tree/master/lib/local/platform
- https://github.com/litixsoft/karma-detect-browsers/tree/master/browsers
That means that each of them has to maintain their information sets independently. Meanwhile, if another module comes along that wants to do something different with available local browsers, it will have to reproduce the information set in its own way.
I wonder if that information set could be pooled into a shared module? Everybody would get the accurate info; if a bug like "Doesn't find Firefox on Windows..." is fixed in the shared module, everybody benefits; and new modules could use it to whatever ends they want.
If not sure if the module should just be an object of information or if it should also have some functionality. Seems plausible to me that each plugin would want to independently control how it uses the information to actually find (and probably run) the browser (?).
At least one problem: I have no idea how to make automated test this kind of thing.
If the data is separate from functionality, one potential problem I can see come up is inadvertently introducing bugs to the code downstream. Since each user of the module is responsible for making use of the data - and therefore each could use it a slightly different way, you could get into edge cases where the metadata works with say testem's way of launching browsers but is breaking launchpad. The only way to prevent that is to run the test suites for all "supported" users, assuming they have tests associated with launching browsers.