alexei / sprintf.js

sprintf.js is a complete open source JavaScript sprintf implementation
BSD 3-Clause "New" or "Revised" License
2.11k stars 290 forks source link

lint testing on PRs, update node.js versions in CI #171

Closed msimerson closed 5 years ago

msimerson commented 5 years ago

Questions:

msimerson commented 5 years ago

Adding lint tests shows up in the Travis CI test output:

$ npm run lint
> sprintf-js@1.1.1 lint /home/travis/build/alexei/sprintf.js
> eslint .
The command "npm run lint" exited with 0.
1.25s
$ npm test
> sprintf-js@1.1.1 test /home/travis/build/alexei/sprintf.js
> mocha test/*.js
  sprintfjs
    ✓ should return formated strings for simple placeholders
    ✓ should return formated strings for complex placeholders
    ✓ should return formated strings for callbacks
  sprintfjs cache
    ✓ should not throw Error (cache consistency)
  sprintfjs
    ✓ should throw SyntaxError for placeholders
    ✓ %b should throw TypeError for invalid numbers
    ✓ %b should not throw TypeError for something implicitly castable to number
    ✓ %c should throw TypeError for invalid numbers
    ✓ %c should not throw TypeError for something implicitly castable to number
    ✓ %d should throw TypeError for invalid numbers
    ✓ %d should not throw TypeError for something implicitly castable to number
    ✓ %i should throw TypeError for invalid numbers
    ✓ %i should not throw TypeError for something implicitly castable to number
    ✓ %e should throw TypeError for invalid numbers
    ✓ %e should not throw TypeError for something implicitly castable to number
    ✓ %f should throw TypeError for invalid numbers
    ✓ %f should not throw TypeError for something implicitly castable to number
    ✓ %g should throw TypeError for invalid numbers
    ✓ %g should not throw TypeError for something implicitly castable to number
    ✓ %u should throw TypeError for invalid numbers
    ✓ %u should not throw TypeError for something implicitly castable to number
    ✓ %x should throw TypeError for invalid numbers
    ✓ %x should not throw TypeError for something implicitly castable to number
    ✓ %X should throw TypeError for invalid numbers
    ✓ %X should not throw TypeError for something implicitly castable to number
    ✓ should not throw Error for expression which evaluates to undefined
    ✓ should throw own Error when expression evaluation would raise TypeError
    ✓ should not throw when accessing properties on the prototype
  28 passing (16ms)

And if lint tests fails, the PR check fails. That lets contributors know their PR needs more work, without a maintainer having to point it out.