From e70fbe3492c37f009dbaccf910c1e0f81e8f0f44 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Sat, 4 Mar 2017 18:31:53 +0100 Subject: [PATCH] Other: Updated travis to pipe to codeclimate, coverage --- .codeclimate.yml | 3 ++- .travis.yml | 2 +- package.json | 2 +- src/reader.js | 1 + tests/api_writer-reader.js | 8 ++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index f9ba9735f..70a0a467b 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -12,4 +12,5 @@ ratings: - "lib/path/**.js" - "lib/pool/**.js" - "lib/utf8/**.js" -exclude_paths: \ No newline at end of file +exclude_paths: + - "**/tests/**" diff --git a/.travis.yml b/.travis.yml index 4bc9fa989..4cd14c077 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,4 @@ matrix: - node_js: 6 script: set -e; if [ -n "$SAUCE_USERNAME" ]; then npm install zuul@^3.11.1 zuul-ngrok@^4.0.0; travis_wait npm run zuul; sleep 3; fi - node_js: 6 - script: npm install coveralls@^2.11.15; npm run coverage-ci + script: npm install coveralls@^2.11.15 codeclimate-test-reporter@^0.4.1; npm run coverage-ci diff --git a/package.json b/package.json index 0ef00df31..b320764bf 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "gulp", "changelog": "node scripts/changelog -w", "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js tests/node/*.js", - "coverage-ci": "npm run coverage && cat coverage/lcov.info | coveralls", + "coverage-ci": "npm run coverage && coveralls < coverage/lcov.info && codeclimate-test-reporter < coverage/lcov.info", "docs": "jsdoc -c jsdoc.docs.json -R README.md --verbose --pedantic", "lint": "eslint **/*.js", "pages": "node scripts/pages", diff --git a/src/reader.js b/src/reader.js index 427678b1e..b6596b6f2 100644 --- a/src/reader.js +++ b/src/reader.js @@ -46,6 +46,7 @@ var create_array = typeof Uint8Array !== "undefined" return new Reader(buffer); throw Error("illegal buffer"); } + /* istanbul ignore next */ : function create_array(buffer) { if (Array.isArray(buffer)) return new Reader(buffer); diff --git a/tests/api_writer-reader.js b/tests/api_writer-reader.js index cb0d95c25..59149145b 100644 --- a/tests/api_writer-reader.js +++ b/tests/api_writer-reader.js @@ -7,6 +7,14 @@ var Writer = protobuf.Writer, tape.test("writer & reader", function(test) { + test.throws(function() { + Reader.create(1); + }, "should throw when creating a Reader from something else than a buffer"); + + test.doesNotThrow(function() { + Reader.create([]); + }, "should not throw when creating a Reader from an array (comp)"); + // uint32, int32, sint32 var values = [