fixed npm test and refactorings of puppet.js