I'm going to be splitting the file up anyway in the next PR, and there's some issues around browserPort not always being set (e.g. for running just a subset of tests), so I'll look at this for that next PR to see what is best here.