Closed
Description
Versions
- NodeJS: 16.13.0
- mongodb-memory-server-*: 8.11.0
- mongodb(the binary version): 6.0.0
- mongodb(the js package): 4.13.0
- system: Ubuntu
package: mongo-memory-server
What is the Problem?
When running 'pnpm test', following error occured:
Instance failed to start because a library is missing or cannot be opened: "libcrypto.so.1.1"
Code Example
import { Test, TestingModule } from '@nestjs/testing';
import { EventController } from './event.controller';
import { EventService } from './event.service';
import {MongoMemoryReplSet} from 'mongodb-memory-server';
import {Event} from '@prisma/client';
import { PrismaService } from '../prisma.service';
import { BadRequestException } from '@nestjs/common';
import { BlockchainService } from '../blockchain/blockchain.service';
describe('EventController', () => {
let controller: EventController;
let prisma: PrismaService;
let mongodb: MongoMemoryReplSet;
let eventModel: Event;
beforeAll(async () => {
mongodb = await MongoMemoryReplSet.create();
});
beforeEach(async () => {
process.env.DATABASE_URL = mongodb.getUri('test');
const module: TestingModule = await Test.createTestingModule({
controllers: [EventController],
providers: [EventService,PrismaService,BlockchainService],
}).compile();
controller = module.get<EventController>(EventController);
eventModel = module.get<Event>(Event);
});
afterEach(async () => {
await prisma.event.deleteMany({});
})
afterAll(async () => {
await mongodb.stop();
});
it('Should throw an error if event id is not valid',async () => {
await expect(() => controller.getEvent('63bbd31c7a644b96fc34dc28')).toThrow(
BadRequestException);
});
});
Debug Output
Debug Output
EventController › Should throw an error if event id is not valid
Instance failed to start because a library is missing or cannot be opened: "libcrypto.so.1.1"
Do you know why it happenes?
no