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.
I guess would make sense is a shared module to get the list of installed browsers, including some informations like exact version or path to executable an so on. But the start/launch of the browsers should be up to the consumer of the module. So the module don't have to care about. An ideally each browser is a own module. They just need to exposes the same api. This would be kind of what the karma test runner does to launch the browsers (http://karma-runner.github.io/0.12/config/browsers.html)