When register is called within another register call, the nested dependency does not seem to decorate the server:
it('exposes server decorations to next register when nested', function (done) {
var server = new Hapi.Server();
server.connection();
var a = function (srv, options, next) {
srv.decorate('server', 'a', function () {
return 'a';
});
return next();
};
a.attributes = {
name: 'a'
};
var b = function (srv, options, next) {
srv.register([a], function(err) {
expect(err).to.not.exist();
return next(typeof srv.a === 'function' ? null : new Error('Missing decoration'));
});
};
b.attributes = {
name: 'b'
};
server.register([b], function (err) {
expect(err).to.not.exist();
server.initialize(function (err) {
expect(err).to.not.exist();
done();
});
});
});
271) Plugin register() exposes server decorations to next register when nested:
Missing decoration
at ./test/plugin.js:1019:36
When register is called within another register call, the nested dependency does not seem to decorate the server:
Fails with:
Related to #2727