diff --git a/lib/application.js b/lib/application.js index 9520afd0f8..c5767e30cd 100644 --- a/lib/application.js +++ b/lib/application.js @@ -17,7 +17,7 @@ module.exports = { init: function () { _.extend(this, { methods: ['find', 'get', 'create', 'update', 'patch', 'remove'], - mixins: mixins, + mixins: mixins(), services: {}, providers: [], _setup: false diff --git a/lib/mixins/index.js b/lib/mixins/index.js index 9ab12c36ad..1e3eff11a6 100644 --- a/lib/mixins/index.js +++ b/lib/mixins/index.js @@ -1,6 +1,8 @@ 'use strict'; -module.exports = [ - require('./promise'), - require('./event') -]; +module.exports = function() { + return [ + require('./promise'), + require('./event') + ]; +}; diff --git a/test/application.test.js b/test/application.test.js index 5d938c742e..3b5f088757 100644 --- a/test/application.test.js +++ b/test/application.test.js @@ -293,4 +293,14 @@ describe('Feathers application', function () { }); }); }); + + it('mixins are unique to one application', function() { + var app = feathers(); + app.mixins.push(function() {}); + assert.equal(app.mixins.length, 3); + + var otherApp = feathers(); + otherApp.mixins.push(function() {}); + assert.equal(otherApp.mixins.length, 3); + }); });