meteor-feature-requests icon indicating copy to clipboard operation
meteor-feature-requests copied to clipboard

Move mongo or minimongo to npm

Open sakulstra opened this issue 7 years ago • 0 comments

Story

I'm currently maintaining a meteor application which was built as a monolith. Testing via mocha at some point got unbearable slow and we just stopped testing meteor related code completely and started using jest for snapshot and unit testing. This works quite okay (after mocking some stuff and working around conditional imports issues (didn't get jest to work with reify)) as testing is now blazing fast, but of course has the huge disadvantage of not testing anything meteor related in a meteor application. We always had the hope that https://github.com/meteor/meteor/blob/devel/Roadmap.md#full-transition-to-npm made it into the next release - looking at the milestones I guess it's save to assume it won't come in short term as there are more important things.

Problem

Mocking mongo stuff for tests is quite time consuming and we currently use a very feature incomplete mock for meteor/mongo we wrote ourselves.

Suggested solution

Move either mongo or minimongo to npm so we can easily use them outside meteor.

Currently when testing non meteor mongodb applications we use the native mongodb package -> create a test database -> run our tests -> dump the database. This works pretty well, but of course is different to the fiber enhanced meteor/mongo so a meteor/mongo nm package would be a huge improvement.

Didn't think about this to much, but if moving meteor/mongo is more problematic than moving meteor/minimongo using minimongo in tests could be sufficient as well. Having a in memory mongodb for testing actually sounds quite intriguing to me and could be useful outside of meteor as well.

Supected outcome

With either one of the packages on npm we could test our methods/publication and most of our other serverside code inside jest which would certainly improve our test coverage a bit :+1:. It's still not 100%, but mocking meteor/meteor for tests seems doable and don't testing the remaining 5% seems ~okay to me.

Related

  • #201 , #51
  • https://github.com/meteor/meteor/blob/devel/Roadmap.md#full-transition-to-npm

How to contribute

That's basically the question i'm asking here. I could spare some time, but I really don't know how to start like noted in #201.

Feature requests should include as much detail as possible:

  • [x] A descriptive title
  • [x] A description of the problem you're trying to solve, including why you think this is a problem
  • [x] An overview of the suggested solution

sakulstra avatar Jun 10 '18 20:06 sakulstra