简体   繁体   中英

How to test NodeJS application using Mocha, Grunt?

Maybe someone met any npm module/tutorial/guide/article about "how to test nodejs application using mocha, gruntjs?" Would be glad to any suggestions.

I'd recommend the following (it worked for me):

  1. Install Grunt and get your first sample grunt task running based on the Grunt documentation
  2. Use this grunt task to get server-side Grunt running Mocha tests for you, and this one for client-side tests. From the command line, you can just run $ grunt to watch the results pop up.
  3. At this point, you can check out Mocha interfaces for samples of how your tests can look. Note that there's also should.js , if you're big on rSpec-style tests. Once you've settled on an interface, more Googling/StackOverflowing is the best way to proceed (eg Google "Mocha should.js examples").

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM