From e17b0e1279682dd7aa06dbb674170dfeecd70d23 Mon Sep 17 00:00:00 2001 From: Marcus Poehls Date: Mon, 4 Apr 2016 12:20:02 +0200 Subject: [PATCH 1/3] use hapi server.stop method directly without using server.root.stop() --- index.js | 2 +- package.json | 2 +- test/index.js | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index fb45b09..3cfda6a 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ exports.register = function(server, options, done) { process.on('message', function(msg) { if (msg === 'shutdown') { server.log(['info', 'pm2', 'shutdown'], 'stopping hapi...'); - server.root.stop(options, function() { + server.stop(options, function() { server.log(['info', 'pm2', 'shutdown'], 'hapi stopped'); return process.exit(0); }); diff --git a/package.json b/package.json index f47aac9..e5f5d2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hapi-graceful-pm2", - "version": "1.0.0", + "version": "1.0.13", "description": "hapi plugin to handle graceful pm2 reloads", "main": "index.js", "scripts": { diff --git a/test/index.js b/test/index.js index 9303e22..9f4bd53 100644 --- a/test/index.js +++ b/test/index.js @@ -15,8 +15,7 @@ lab.experiment("hapi-graceful-pm2", () => { lab.beforeEach((done) => { sinon.stub(process, 'on').returns(); sinon.stub(process, 'exit'); - server.root = {}; - server.root.stop = sinon.stub(); + server.stop = sinon.stub(); server.log = sinon.stub(); return plugin.register(server, options, done); @@ -41,11 +40,11 @@ lab.experiment("hapi-graceful-pm2", () => { lab.test("should stop server if shutdown", (done) => { server.log.returns(); - server.root.stop.yields(); + server.stop.yields(); process.exit.restore(); sinon.stub(process, 'exit', function(code) { code.should.equal(0); - server.root.stop.calledOnce.should.be.true; + server.stop.calledOnce.should.be.true; return done(); }); From affdadd9fb42dbb3cf5993e3d0abc20c5e050fa0 Mon Sep 17 00:00:00 2001 From: Marcus Poehls Date: Mon, 4 Apr 2016 12:31:06 +0200 Subject: [PATCH 2/3] remove pre-push hook --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index e5f5d2e..cca8bbe 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,6 @@ "test": "lab -c -t 100", "coveralls": "lab -t 100 -r lcov | coveralls" }, - "git-pre-hooks": { - "pre-push": "npm test" - }, "repository": { "type": "git", "url": "git+https://github.com/roylines/hapi-graceful-pm2.git" From 28c473de7f3ae4f70e353b777aa33dd659d3bd7a Mon Sep 17 00:00:00 2001 From: Marcus Poehls Date: Mon, 4 Apr 2016 12:31:46 +0200 Subject: [PATCH 3/3] readd pre-push hook --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index cca8bbe..e5f5d2e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "test": "lab -c -t 100", "coveralls": "lab -t 100 -r lcov | coveralls" }, + "git-pre-hooks": { + "pre-push": "npm test" + }, "repository": { "type": "git", "url": "git+https://github.com/roylines/hapi-graceful-pm2.git"