diff options
| author | Nick Merwin <[email protected]> | 2019-11-20 17:05:48 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-11-20 17:05:48 -0800 |
| commit | 336123fe05e7f80d79fc8522b4ff21a60fffe77c (patch) | |
| tree | 97e5b9343471fc73ddf4ffb20cd71ca58367d6c6 /lib/sendToCoveralls.js | |
| parent | eba01a29c69f28ffd7f50556492a43b5ba2486d7 (diff) | |
| download | node-coveralls-336123fe05e7f80d79fc8522b4ff21a60fffe77c.tar.xz node-coveralls-336123fe05e7f80d79fc8522b4ff21a60fffe77c.zip | |
ES6
* remove unused variables
* move `require`s at the top
* check for prototype built-ins
* run in strict mode
* always check for error values in tests
* make style consistent
* mark Node.js 6 as the minimum supported version in package.json
* Use the arrow return syntax
* logger.js: use `Boolean` to make the intention clearer.
* Use the rest params instead of arguments.
* test/getOptions.js: beautify git data.
* Update logger.js
Remove `hasDebugEnvVariable` function; it's just a `process.env` check
* Create .jshintrc
Diffstat (limited to 'lib/sendToCoveralls.js')
| -rw-r--r-- | lib/sendToCoveralls.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/sendToCoveralls.js b/lib/sendToCoveralls.js index fcf63a8..0421556 100644 --- a/lib/sendToCoveralls.js +++ b/lib/sendToCoveralls.js @@ -1,20 +1,27 @@ -var request = require('request'); -var index = require('../index'); +'use strict'; -var sendToCoveralls = function(obj, cb){ - var urlBase = 'https://coveralls.io'; +const request = require('request'); +const index = require('..'); + +const sendToCoveralls = (obj, cb) => { + let urlBase = 'https://coveralls.io'; if (process.env.COVERALLS_ENDPOINT) { urlBase = process.env.COVERALLS_ENDPOINT; } - var str = JSON.stringify(obj); - var url = urlBase + '/api/v1/jobs'; - + const str = JSON.stringify(obj); + const url = `${urlBase}/api/v1/jobs`; + if (index.options.stdout) { process.stdout.write(str); cb(null, { statusCode: 200 }, ''); } else { - request.post({url : url, form : { json : str}}, function(err, response, body){ + request.post({ + url, + form: { + json: str + } + }, (err, response, body) => { cb(err, response, body); }); } |
