testcontainers-mongoose
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Testcontainers-mongoose

a mongoose helper for using testcontainers with mongodb

https://www.npmjs.com/package/testcontainers-mongoose

Installation

npm i -D testcontainers-mongoose

Configuration

Reference

Logs

  • DEBUG=testcontainers Enable testcontainers logs
  • DEBUG=testcontainers:containers Enable container logs
  • DEBUG=testcontainers* Enable all logs

Testcontainers

  • TESTCONTAINERS_RYUK_DISABLED=true Disable ryuk
  • RYUK_CONTAINER_IMAGE=registry.mycompany.com/mirror/ryuk:0.3.0 Custom image for ryuk

Usage

Testing with Vitest

import * as dbHandler from 'testcontainers-mongoose'
import { describe, beforeAll, afterAll, afterEach, it, expect } from 'vitest'

describe('testcontainers-mongoose test', () => {
  beforeAll(async () => {
    await dbHandler.connect('harbor.yourcompany.com/mongo:4.4.4')
    // ...
  })
  afterAll(async () => {
    await dbHandler.closeDatabase()
  })

  afterEach(async () => {
    await dbHandler.clearDatabase()
  })

  it('some test using mongoose', async () => {
    // ...
  })
})

Install

npm i testcontainers-mongoose

DownloadsWeekly Downloads

197

Version

2.0.0

License

MIT

Unpacked Size

21.7 kB

Total Files

16

Last publish

Collaborators

  • yubintw