User semver.compare to make sure latest version is detected correctly

1.16 should be later than 1.8.

I had the issue that mocha 1.8.2 was selected as the latest version while 1.16.2 was mirrored as well.