diff --git a/.travis.yml b/.travis.yml index 0fa76b9..b6c2935 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,13 @@ sudo: false node_js: - "6" - "8" - - "9" - "10" git: depth: false env: - - STAN_VERSION=v0.8.0-beta + - STAN_VERSION=v0.11.0 before_script: - wget "https://github.com/nats-io/nats-streaming-server/releases/download/$STAN_VERSION/nats-streaming-server-$STAN_VERSION-linux-amd64.zip" -O tmp.zip @@ -21,10 +20,10 @@ before_script: script: - - if [[ "$TRAVIS_NODE_VERSION" == 4 ]]; then npm test; fi - - if [[ "$TRAVIS_NODE_VERSION" == 6 ]]; then npm test; fi - - if [[ "$TRAVIS_NODE_VERSION" == 8 ]]; then npm test; fi - - if [[ "$TRAVIS_NODE_VERSION" == 9 ]]; then npm run coveralls; fi + - npm test + +after_success: + - if [[ "$TRAVIS_NODE_VERSION" == 10 ]]; then npm run coveralls; fi after_failure: - cat nats-streaming-server/logs/*.log \ No newline at end of file diff --git a/Makefile b/Makefile index 3b66898..cb23029 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ lint: ./node_modules/.bin/jshint ./test ./index.js ./lib/stan.js test: - @NODE_ENV=test ./node_modules/.bin/mocha -c\ + @NODE_ENV=test ./node_modules/.bin/mocha --exit -c\ --reporter list \ --slow 5000 \ --timeout 10000 diff --git a/README.md b/README.md index 8cb945a..403534c 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,12 @@ Node NATS Streaming is an extremely performant, lightweight reliable streaming p [![license](https://img.shields.io/github/license/nats-io/node-nats-streaming.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![Travis branch](https://img.shields.io/travis/nats-io/node-nats-streaming/master.svg)]() -[![Coveralls github branch](https://img.shields.io/coveralls/github/nats-io/node-nats-streaming/master.svg)]() -[![npm](https://img.shields.io/npm/v/node-nats-streaming.svg)](https://www.npmjs.com/package/node-nats-streaming) +[![Coverage Status](https://coveralls.io/repos/github/nats-io/node-nats-streaming/badge.svg?branch=master)](https://coveralls.io/github/nats-io/node-nats-streaming?branch=master)[![npm](https://img.shields.io/npm/v/node-nats-streaming.svg)](https://www.npmjs.com/package/node-nats-streaming) [![npm](https://img.shields.io/npm/dt/node-nats-streaming.svg)](https://www.npmjs.com/package/node-nats-streaming) + + NATS Streaming provides the following high-level feature set: - Log based persistence - At-Least-Once Delivery model, giving reliable message delivery diff --git a/lib/stan.js b/lib/stan.js index e17b656..f149f99 100644 --- a/lib/stan.js +++ b/lib/stan.js @@ -30,7 +30,7 @@ var util = require('util'), /** * Constants */ -var VERSION = '0.0.41', +var VERSION = '0.0.50', DEFAULT_PORT = 4222, DEFAULT_PRE = 'nats://localhost:', DEFAULT_URI = DEFAULT_PRE + DEFAULT_PORT, @@ -413,6 +413,7 @@ Stan.prototype.publish = function(subject, data, ackHandler) { if (this.nc === undefined) { if (util.isFunction(ackHandler)) { ackHandler(new Error(CONN_CLOSED)); + return; } else { throw new Error(CONN_CLOSED); } @@ -654,6 +655,7 @@ Subscription.prototype.close = function() { function closeOrUnsubscribe(that, doClose) { if(that.isClosed()) { that.emit('error', new Error(BAD_SUBSCRIPTION)); + return; } var sc = that.stanConnection; diff --git a/package.json b/package.json index 4c15e0f..19010b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-nats-streaming", - "version": "0.0.41", + "version": "0.0.50", "description": "Node.js client for NATS Streaming, a lightweight, high-performance cloud native messaging system", "keywords": [ "nats", @@ -29,18 +29,17 @@ "contributors": [], "main": "./index.js", "scripts": { - "cover": "istanbul cover _mocha", - "coveralls": "npm run cover -- --report lcovonly && cat ./reports/coverage/lcov.info | coveralls", + "coveralls": "cat ./reports/coverage/lcov.info | coveralls", "depcheck": "dependency-check . lib/* lib/pb/*", "depcheck:unused": "dependency-check ./package.json --unused --no-dev lib/*.js", "gen": "protoc --js_out=import_style=commonjs,library=lib/pb/protocol_pb,binary:. lib/pb/protocol.proto", "lint": "jshint --reporter node_modules/jshint-stylish lib/*.js test/*.js test/support/*.js examples/*.js", "npm-publish": "npm publish https://github.com/nats-io/node-nats-streaming.git --access public", "test": "npm run depcheck && npm run depcheck:unused && npm run lint && npm run test:unit", - "test:unit": "mkdir -p reports/ && NODE_ENV=test multi='spec=- xunit=reports/mocha-xunit.xml' istanbul cover _mocha -- -R mocha-multi --timeout 10000 --slow 750 && istanbul check-coverage" + "test:unit": "mkdir -p reports/ && NODE_ENV=test multi='spec=- xunit=reports/mocha-xunit.xml' istanbul cover _mocha -- -R mocha-multi --exit --timeout 10000 --slow 750 && istanbul check-coverage" }, "engines": { - "node": ">= 0.10.x <10.0.0" + "node": ">= 6.0.0" }, "dependencies": { "google-protobuf": "^3.3.0", @@ -48,14 +47,14 @@ "nuid": "^1.0.0" }, "devDependencies": { - "coveralls": "^2.11.2", + "coveralls": "^3.0.2", "dependency-check": "2.6.x", "istanbul": "^0.4.5", - "jshint": "^2.9.5", + "jshint": "^2.9.6", "jshint-stylish": "^2.2.1", - "mocha": "^3.0.2", + "mocha": "^5.2.0", "mocha-lcov-reporter": "1.2.x", - "mocha-multi": "^0.9.1", + "mocha-multi": "^1.0.1", "should": "^11.2.1" }, "typings": "./index.d.ts"