hwillson / meteor-stub-collections

Stub out Meteor collections with in-memory local collections.
MIT License
24 stars 17 forks source link

Wrong import after updating to Meteor 1.5 #17

Closed SimonSimCity closed 7 years ago

SimonSimCity commented 7 years ago

After updating to Meteor 1.5, I see a strange import behavior on this module ...

I imported the module as you described in the documentation:

import StubCollections from 'meteor/hwillson:stub-collections';

After updating Meteor I realized, that I can't call StubCollections.stub() but have to call StubCollections.default.stub() instead. Is this a bug in Meteor or this library?

SimonSimCity commented 7 years ago

After trying a bit more here and there, I found out that the update (for some reason) made this package useless, because the imported object isn't referenced any-longer but a new instance. This means, that the library I want to test has a different collection in my test-file than in the file to test, which makes this package useless to me ... It seems more and more to me that this came with the changes meteor did to the importing as they were working on dynamic imports.

hwillson commented 7 years ago

Hi @SimonSimCity - this doesn't appear to be an issue with this package. Here's a quick repro showing that it's working with 1.5:

meteor create --bare stub-test
cd stub-test
meteor add hwillson:stub-collections
echo "import StubCollections from 'meteor/hwillson:stub-collections'; console.log(StubCollections);" > index.js
meteor

The above will log the proper StubCollections object, which you can then call stub on directly. Sounds like something else in your project might be impacting this?

hwillson commented 7 years ago

Just saw your new response - okay, sounds like this isn't an issue with this package then. Closing - thanks!