Unit Testing with Node.js

Unit Testing with Node.js

2019, Jan 10    

Unittest with MongoDB (In-memory Database)

Document for the idea of in-memory MongoDB instance: https://jestjs.io/docs/en/mongodb

A working example: https://github.com/backslash112/jest-mongodb

Useful Commands

Use dotenv Envirement varible in Jest:

jest --setupFiles dotenv/config

Show converage report in Jest:

jest --coverage

Run all tests serially in the current process:

jest --runInBand

Reference