Fix JSHint warnings and add to npm test