GithubHelp home page GithubHelp logo

Comments (5)

nodkz avatar nodkz commented on May 10, 2024 1

I think that this difference in error messages depends on mongodb version.

If your testing and production versions of mongodb are the same, then you need to try make storageEngine the same. By default it is in memory.

So if it helps, please put here your solution for future googlers.

PS. You may spin app for some tests regular mongo instance, but for other tests - default in memory for spead.

from mongodb-memory-server.

lirbank avatar lirbank commented on May 10, 2024 1

Confirming that changing the engine to wiredTiger (same as for production) gives the correct errmsg .

new MongodbMemoryServer({
  binary: {
    version: '4.0.2',
  },
  instance: {
    // Available engines:
    // storageEngines: [ 'devnull', 'ephemeralForTest', 'mmapv1', 'wiredTiger' ],
    storageEngine: 'wiredTiger',
  },
});

from mongodb-memory-server.

nodkz avatar nodkz commented on May 10, 2024 1

@lirbank wow great!

Please open Pull Request for README.md - add links to your packages under Jest section.
Thanks!

from mongodb-memory-server.

lirbank avatar lirbank commented on May 10, 2024

Ok, cool! I have the same version but not the same engine. I'm going to try that. Keep you posted.

from mongodb-memory-server.

lirbank avatar lirbank commented on May 10, 2024

For future googlers:

I've published a package that enables you to set the storage engine per test file in Jest. It also enables you to keep a single mongodb-memory-server server running between tests when you run Jest in watch mode, and other good stuff.

https://www.npmjs.com/package/jest-environment-mongodb (docs here)
https://www.npmjs.com/package/jest-environment-mongodb-wiredtiger
https://www.npmjs.com/package/jest-environment-mongodb-ephemeral

from mongodb-memory-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.