{"action":"created","issue":{"url":"https://api.github.com/repos/hapijs/hapi/issues/3043","repository_url":"https://api.github.com/repos/hapijs/hapi","labels_url":"https://api.github.com/repos/hapijs/hapi/issues/3043/labels{/name}","comments_url":"https://api.github.com/repos/hapijs/hapi/issues/3043/comments","events_url":"https://api.github.com/repos/hapijs/hapi/issues/3043/events","html_url":"https://github.com/hapijs/hapi/issues/3043","id":131043721,"number":3043,"title":"Gulp test won't exit when using inject method for integration test","user":{"login":"noppanit","id":638379,"avatar_url":"https://avatars.githubusercontent.com/u/638379?v=3","gravatar_id":"","url":"https://api.github.com/users/noppanit","html_url":"https://github.com/noppanit","followers_url":"https://api.github.com/users/noppanit/followers","following_url":"https://api.github.com/users/noppanit/following{/other_user}","gists_url":"https://api.github.com/users/noppanit/gists{/gist_id}","starred_url":"https://api.github.com/users/noppanit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noppanit/subscriptions","organizations_url":"https://api.github.com/users/noppanit/orgs","repos_url":"https://api.github.com/users/noppanit/repos","events_url":"https://api.github.com/users/noppanit/events{/privacy}","received_events_url":"https://api.github.com/users/noppanit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-02-03T14:35:35Z","updated_at":"2016-02-03T15:59:37Z","closed_at":null,"body":"I'm trying to do a simple integration testing but after the test is done it won't exit to command line. It's just stuck there. \r\n\r\nHere's the code.\r\n\r\n```\r\n'use strict';\r\n\r\nvar Hapi = require('hapi');\r\nvar Inert = require('inert');\r\nvar Vision = require('vision');\r\n\r\nvar log = require('./logger');\r\nvar config = require('./config');\r\nvar extensions = require('./extensions');\r\n\r\nvar server = new Hapi.Server({});\r\nserver.connection({ port: config.port });\r\nrequire('./routes')(server);\r\n\r\n// adds metadata to responses, and customizes error responses\r\nserver.ext({\r\n  type: 'onPreResponse',\r\n  method: function preResponse(request, reply) {\r\n    extensions.handlePreResponse(request, reply);\r\n    return reply.continue();\r\n  }\r\n});\r\n\r\nserver.on('request-error', extensions.handleOnRequestError);\r\n\r\nserver.register(\r\n  [\r\n    Inert,\r\n    Vision,\r\n    require('./plugins/swaggerPlugin')\r\n  ],\r\n  function handlePluginRegistrationError(err) {\r\n    if (err) {\r\n      log.warn(JSON.stringify(err));\r\n      throw err; // something bad happened loading the plugins\r\n    }\r\n    server.start(function serverStartedCallback() {\r\n      log.warn('DAL services listening on port '+config.port+'...');\r\n      log.warn('Server running at: ' + server.info.uri);\r\n    });\r\n  }\r\n);\r\n\r\nmodule.exports = server;\r\n```\r\n\r\nHere's the test\r\n```\r\n'use strict';\r\n\r\nvar chai = require('chai');\r\nvar expect = chai.expect;\r\nvar server = require('../../../index');\r\n\r\ndescribe('Root Integration Tests', function desc() {\r\n  it('should get root route', function it(done) {\r\n    var options = {\r\n      method: \"GET\",\r\n      url: \"/\"\r\n    };\r\n    server.inject(options, function(response) {\r\n      expect(response.statusCode).to.equal(200);\r\n      done();\r\n    });\r\n  });\r\n});\r\n```\r\n\r\nHere's my gulp. \r\n```\r\ngulp.task('integration-test', function performIntegrationTests() {\r\n  return gulp.src(['tests/integration/**/*.js'])\r\n    .pipe(mocha({'reporter': 'dot', 'timeout': 30000}));\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/hapijs/hapi/issues/comments/179310845","html_url":"https://github.com/hapijs/hapi/issues/3043#issuecomment-179310845","issue_url":"https://api.github.com/repos/hapijs/hapi/issues/3043","id":179310845,"user":{"login":"vdeturckheim","id":7135896,"avatar_url":"https://avatars.githubusercontent.com/u/7135896?v=3","gravatar_id":"","url":"https://api.github.com/users/vdeturckheim","html_url":"https://github.com/vdeturckheim","followers_url":"https://api.github.com/users/vdeturckheim/followers","following_url":"https://api.github.com/users/vdeturckheim/following{/other_user}","gists_url":"https://api.github.com/users/vdeturckheim/gists{/gist_id}","starred_url":"https://api.github.com/users/vdeturckheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdeturckheim/subscriptions","organizations_url":"https://api.github.com/users/vdeturckheim/orgs","repos_url":"https://api.github.com/users/vdeturckheim/repos","events_url":"https://api.github.com/users/vdeturckheim/events{/privacy}","received_events_url":"https://api.github.com/users/vdeturckheim/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T15:59:37Z","updated_at":"2016-02-03T15:59:37Z","body":"It is a personal choice. Go with the one you like but that's another topic."}}