[#801] Simplified the logic for running the mocha tests in and out of browser