npm installs mocha version which is not fully compatible with node versions in my package

What I Wanted to Do

I tried to build project on travis-ci

What Happened Instead

Building failed on Node versions older than 6 in spite of suitable mocha version’s presence in list in package.json

Details

Build failed:
https://travis-ci.com/Aisse-258/bigint-json-native/builds/118256733
Mocha:


package.json:

$ npm --versions
2.15.1
2.3.0
2.15.11
3.8.6
$ node -p process.platform
win32

npm does not check the engine field until after the install, it does not affect which version of mocha is installed.