-
-
Notifications
You must be signed in to change notification settings - Fork 188
Closed
Description
Versions
- NodeJS: v17.6.0
- mongodb-memory-server-*: 8.8.0
- mongodb(the binary version): 0.0.0
- mongodb(the js package): 0.0.0
- mongoose: 6.4.7
- system: ubuntu 20.04
package:
mongo-memory-server
What is the Problem?
Locally everything passes, but on circle ci it tries to download the binary even tho it's already there.
By running node node_modules/mongodb-memory-server/postinstall.js on CircleCi I see this output:
However then down the line when I run my tests:
in addition, the SYSTEM_BINARY env variable is set to the path where the binary is.
Code Example
// .circleci.config.yml
version: 2.1
orbs:
node: circleci/node@5.0.2
jobs:
main:
docker:
- image: cimg/node:lts-browsers
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- run: echo $SYSTEM_BINARY
- run: node node_modules/mongodb-memory-server/postinstall.js
- run: yarn test:api
workflows:
build:
jobs:
- main
// mock-db-test-util.js
import { MongoMemoryServer } from "mongodb-memory-server"
import mockMongoose from "mongoose"
const mockMongoMemoryServer = MongoMemoryServer.create()
// @ts-ignore
jest.mock("../../src/db", () => ({
// @ts-ignore
...(jest.requireActual("../../src/db").default as any),
// @ts-ignore
connect: jest.fn().mockImplementation(async () => {
const mongo = await mockMongoMemoryServer
const uri = mongo.getUri()
await mockMongoose.connect(uri)
}),
}))Do you know why it happenes?
no
Metaphysics0

