Skip to content

A test setup using Mongoose, MongoDB Memory Server and Jest

License

Notifications You must be signed in to change notification settings

pedromdev/mongoose-jest-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mongoose Jest setup

A test setup using Mongoose, MongoDB Memory Server and Jest.

Follow these steps to getting start:

$ git clone https://github.com/pedromdev/mongoose-jest-setup.git
$ cd mongoose-jest-setup
$ npm i
$ npm run test

To start the MongoDB memory server and connect to it with mongoose, you just need call MongooseConnection.open on beforeAll:

beforeAll(async () => {
  await MongooseConnection.open()
});

And to stop the server and mongoose, call MongooseConnection.close on afterAll:

afterAll(async () => {
  await MongooseConnection.close()
});

About

A test setup using Mongoose, MongoDB Memory Server and Jest

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published