{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/278","repository_url":"https://api.github.com/repos/balderdashy/sails-mongo","labels_url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/278/comments","events_url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/278/events","html_url":"https://github.com/balderdashy/sails-mongo/issues/278","id":75310796,"number":278,"title":"Cannot read property 'collections' of undefined running unit tests.","user":{"login":"ronsuez","id":3076073,"avatar_url":"https://avatars.githubusercontent.com/u/3076073?v=3","gravatar_id":"","url":"https://api.github.com/users/ronsuez","html_url":"https://github.com/ronsuez","followers_url":"https://api.github.com/users/ronsuez/followers","following_url":"https://api.github.com/users/ronsuez/following{/other_user}","gists_url":"https://api.github.com/users/ronsuez/gists{/gist_id}","starred_url":"https://api.github.com/users/ronsuez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronsuez/subscriptions","organizations_url":"https://api.github.com/users/ronsuez/orgs","repos_url":"https://api.github.com/users/ronsuez/repos","events_url":"https://api.github.com/users/ronsuez/events{/privacy}","received_events_url":"https://api.github.com/users/ronsuez/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/balderdashy/sails-mongo/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/balderdashy/sails-mongo/labels/repro%20please","name":"repro please","color":"000000"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-05-11T18:16:21Z","updated_at":"2016-05-02T22:40:04Z","closed_at":"2016-01-25T20:53:11Z","body":"I'm running an unit test suite for sails, but when i try to run it, i get this error: \r\n\r\n```javascript\r\n     var collection = connectionObject.collections[collectionName];\r\n                                       ^\r\nTypeError: Cannot read property 'collections' of undefined\r\n    at Object.module.exports.adapter.create (/Users/ron/Projects/sails/ap/node_modules/sails-mongo/lib/adapter.js:268:40)\r\n    at module.exports.create (/Users/ron/Projects/sails/ap/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:85:13)\r\n    at bound.createValues (/Users/ron/Projects/sails/ap/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:213:16)\r\n    at /Users/ron/Projects/sails/ap/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:74:20\r\n    at /Users/ron/Projects/sails/ap/node_modules/async/lib/async.js:254:17\r\n    at /Users/ron/Projects/sails/ap/node_modules/async/lib/async.js:157:25\r\n    at /Users/ron/Projects/sails/ap/node_modules/async/lib/async.js:251:21\r\n    at /Users/ron/Projects/sails/ap/node_modules/async/lib/async.js:615:34\r\n    at /Users/ron/Projects/sails/ap/node_modules/async/lib/async.js:157:25\r\n    at /Users/ron/Projects/sails/ap/api/models/User.js:48:21\r\n```\r\n\r\nMy mocha config as follows:\r\n\r\n```javascript\r\nvar Sails = require('sails');\r\nvar app;\r\nbefore(function(done) {\r\n  Sails.lift({\r\n    connections: {\r\n      mongo: {\r\n        database: 'unit-test-db'\r\n      }\r\n    },\r\n    models: {\r\n      migrate: 'drop'\r\n    },\r\n    log: {\r\n      level: 'debug'\r\n    },\r\n    hooks: {\r\n      grunt: false,\r\n      i18n: false\r\n    }\r\n  }, function(err, sails) {\r\n    app = sails;\r\n    done(err, app);\r\n  });\r\n});\r\n\r\nafter(function(done) {\r\n   app.lower(function () {\r\n      done(); \r\n    });\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/comments/216386379","html_url":"https://github.com/balderdashy/sails-mongo/issues/278#issuecomment-216386379","issue_url":"https://api.github.com/repos/balderdashy/sails-mongo/issues/278","id":216386379,"user":{"login":"particlebanana","id":370260,"avatar_url":"https://avatars.githubusercontent.com/u/370260?v=3","gravatar_id":"","url":"https://api.github.com/users/particlebanana","html_url":"https://github.com/particlebanana","followers_url":"https://api.github.com/users/particlebanana/followers","following_url":"https://api.github.com/users/particlebanana/following{/other_user}","gists_url":"https://api.github.com/users/particlebanana/gists{/gist_id}","starred_url":"https://api.github.com/users/particlebanana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/particlebanana/subscriptions","organizations_url":"https://api.github.com/users/particlebanana/orgs","repos_url":"https://api.github.com/users/particlebanana/repos","events_url":"https://api.github.com/users/particlebanana/events{/privacy}","received_events_url":"https://api.github.com/users/particlebanana/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T22:40:04Z","updated_at":"2016-05-02T22:40:04Z","body":"@wlemahieu not sure I follow. Do you have something restarting your app when you save a file? Essentially this errors means something has already released the connection and the server no longer knows about it."}}