mocha and chai

44 views
Skip to first unread message

Priyambada Madhual

unread,
Oct 16, 2020, 1:08:44 PM10/16/20
to Chai.js
hello, i want to implement mocha and chai in my hapi.js api code so how i start it 

Robin

unread,
Oct 18, 2020, 12:18:57 PM10/18/20
to Chai.js
I'm pretty sure you DON'T want to have mocha and chai in your hapi code. Hapi will be used to build and configure a server in code, and the module dependency saved for production use (`npm i -S hapi`) - your mocha/chai should be separate and only used for testing/CI (`npm i -D mocha chai`). Any time you find yourself writing a function in your hapi code, extract it to a library file and import it into your hapi code, that way you can also import the same function into your mocha/chai test code and write tests as required.
Reply all
Reply to author
Forward
0 new messages