Jest-mongo and Ubuntu 22.04

Hi, jest is a test framework with almost 4 million public repos on github.

Jest has instructions to use MongoMemoryServer for testing:

Unfortunately, it doesn’t work on Ubuntu 22.04 because of a libcrypto problem:

How can I get a libcrypto that Mongo likes on Ubuntu?

Or what is jest-mongo missing to work?

Here is someone elses github project that reproduces the issue: GitHub - renatopsdev/clean-code-api: This is an API developed during the course "Rest API NodeJs using TDD, Clean Architecture and Typescript"

Thank you!

1 Like

MongoDB 6.0.3 supports Ubuntu 22.04 but the documentation has not been updated to reflect this.

1 Like

Problem:
MongoMemoryServer uses v5.0.13 which doesn’t support Ubuntu 22.04.

Solution:
You can use latest mongodb version by configuring jest-mongodb using jest-mongodb-config.js

module.exports = {
  mongodbMemoryServerOptions: {
    binary: {
      version: '6.0.6',
      skipMD5: true,
    },
    autoStart: false,
    instance: {},
  },
};

This works perfectly fine in Ubuntu 22.04

References: