fix #1143 mocha tests failing on patch builds

New versions of npm (1.4.x) transform the version entry in package.json
from the form like `1.4.17A` to `1.4.17-A` in the env variable.

Hence our build was failing on patch builds when new version of npm was used.

(cherry picked from commit 420de99bc8064eaea7c669cf4b6197b16bd34973)