Unable to run angular cli tests

I am using followig config file. I want node 6+ and npm 3+ to run angularcli tests. Even though I have added dependencies to install these versions, the machines contain node 4 and npm 2 which fails my tests! If I ssh to the machine and install these versions manually, things work fine.

dependencies:
override:
- nvm install 6 && npm install
test:
override:
- nvm use 6 && ng test