DEV Community

S. M. Ahad Ali Chowdhury
S. M. Ahad Ali Chowdhury

Posted on • Edited on

1

testing node js api using mocha and chai

testing node js api using chai and mocha

first following the step for installing mocha and chai

  1. npm install mocha --save-dev
  2. npm install chai --save-dev
  3. npm install chai-http --save-dev
  4. go to the package.json file and write in scripts "test": "mocha"
  5. then create a folder and create a file (like api.js) and code your testing
  6. Write npm test in terminal for testing the test

for better understanding you can try below link for understanding how mocha and chai work and how we write testing code for test our application------

https://www.digitalocean.com/community/tutorials/test-a-node-restful-api-with-mocha-and-chai

Top comments (0)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay