Hello.We are using tape+gulp for testing our hapi server. At first I create a mock:
var server;
serverMock(function(obj) {
server = obj;
test.end();
});
serverMock is a module
var _ = require('lodash');
var Hapi = require('hapi');
var config = require('../../config');
var cacheMock = require('./cache');
module.exports = function(done) {
var server = new Hapi.Server();
server.connection();
server.route(require('../../server/routes'));
var cache = server.cache({segment: 'first', expiresIn: config.cache.expiresIn});
cache._cache.start(_.noop);
var methods = require('../../server/methods');
server.method('first.cache', methods.cache, {bind: cache});
server.method('first.get', methods.get, {bind: cache});
cache.set(cacheMock.id, cacheMock);
server.start(function() {
return done(server);
});
};
Then test is passing. And at the end:
I want to notice that all tape.end() functions is called but process still alive. I think its because server keep it alive. Maybe you can help me..
Hello.We are using tape+gulp for testing our hapi server. At first I create a mock:
serverMock is a module
Then test is passing. And at the end:
I want to notice that all tape.end() functions is called but process still alive. I think its because server keep it alive. Maybe you can help me..