typegoose / mongodb-memory-server

Manage & spin up mongodb server binaries with zero(or slight) configuration for tests.
https://typegoose.github.io/mongodb-memory-server/
MIT License
2.57k stars 185 forks source link

MongoMemoryReplSet hangs tests in Bun #800

Closed robertherber closed 10 months ago

robertherber commented 11 months ago

Versions

package: mongo-memory-server

What is the Problem?

When running bun test it hangs on mongodb.stop(). It does work with MongoMemoryServer but not with MongoMemoryReplSet.

Code Example

import {
  expect, beforeAll, test, afterAll,
} from 'bun:test'

let mongodb
beforeAll(async () => {
  const memoryServer = await import('mongodb-memory-server')
  mongodb = await memoryServer.MongoMemoryReplSet.create()
})

test('a test', () => {
  expect(1 + 1).toEqual(2)
})

afterAll(async () => {
  console.log('stopping mongodb')
  await mongodb.stop() // <-- hangs here
  console.log('stopping mongodb')
})

Not sure why it happens, and not really getting any useful output. This issue might very well belong in the bun repo. I'm happy to move the issue there - but any context as to what could be different between the two implementations might be helpful when moving it there :)

hasezoey commented 11 months ago

please provide Debug Output

also note that other engines other than nodejs are not officially supported, though deno is tested through mongoose (not the full suite though) and a lot of issues (mostly inside the mongodb driver) have come up with deno

also maybe try the latest beta 9.0.0-beta.2

github-actions[bot] commented 10 months ago

Marking the Issue as stale, it will be closed in 7 days if no more activity is seen

github-actions[bot] commented 10 months ago

Closing the Issue because it is marked as stale