diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..2d35a28 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1 @@ +repo_token: BBxFx4UNsB6qoGOcYY5CXfYrfcwjItWVm diff --git a/.travis.yml b/.travis.yml index 1cde613..3e55d27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,5 @@ language: node_js node_js: - 12 - 14 + +after_success: yarn coverage diff --git a/README.md b/README.md index cbf9e85..555b31e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ ## Basic usage example +[![Build Status](https://travis-ci.org/birkestroem/node-fetch-backoff.svg?branch=master)](https://travis-ci.org/birkestroem/node-fetch-backoff) +[![Coverage Status](https://coveralls.io/repos/github/birkestroem/node-fetch-backoff/badge.svg?branch=master)](https://coveralls.io/github/birkestroem/node-fetch-backoff?branch=master) + + ```js -const fbFactory = require('node-fetch-backoff'); -const fetch = fbFactory({ +const nfbFactory = require('node-fetch-backoff'); +const fetch = nfbFactory({ // Msec or function. Default is exponential delay using msec from this option. delay: 10 * 1000, diff --git a/jest.config.js b/jest.config.js index 5ddc894..8baa821 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ module.exports = { clearMocks: true, coverageDirectory: "coverage", - coverageReporters: ["json", "html"], + coverageReporters: ["lcov", "html"], testEnvironment: "node", }; diff --git a/package.json b/package.json index f3758a0..403309a 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "A persistent version of fetch", "main": "src/index.js", "dependencies": { + "coveralls": "3.1.0", "debug": "4.2.0", "node-fetch": "2.6.1" }, @@ -16,6 +17,7 @@ "nock": "13.0.5" }, "scripts": { + "coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls", "lint": "eslint src", "test": "jest" }, diff --git a/yarn.lock b/yarn.lock index 53e99be..7a779b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1167,6 +1167,17 @@ core-util-is@1.0.2: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +coveralls@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.0.tgz#13c754d5e7a2dd8b44fe5269e21ca394fb4d615b" + integrity sha512-sHxOu2ELzW8/NC1UP5XVLbZDzO4S3VxfFye3XYCznopHy02YjNkHcj5bKaVw2O7hVaBdBjEdQGpie4II1mWhuQ== + dependencies: + js-yaml "^3.13.1" + lcov-parse "^1.0.0" + log-driver "^1.2.7" + minimist "^1.2.5" + request "^2.88.2" + cross-spawn@^6.0.0: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -2880,6 +2891,11 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== +lcov-parse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" + integrity sha1-6w1GtUER68VhrLTECO+TY73I9+A= + leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -2946,6 +2962,11 @@ lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +log-driver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== + make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"