vic/mecha
Ensure your node examples/*.js work by using them as mocha tests.
{ "defaultBranch": "master", "description": "Ensure your node examples/*.js work by using them as mocha tests.", "fullName": "vic/mecha", "homepage": "http://vic.github.com/mecha", "language": "JavaScript", "name": "mecha", "pushedAt": "2012-08-25T06:23:13Z", "stargazersCount": 0, "updatedAt": "2013-10-12T02:17:19Z", "url": "https://github.com/vic/mecha"}Ensure your node examples/*.js work by using them as mocha tests.
Add mecha to your package.json devDependencies
npm installNow your example files can use mocha when run.
// This is my awesome project example at examples/awesome.jsvar mecha = require('mecha');
// use `describe' and `it`mecha.log("This will be printed only when run directly as an example");
// when run as an example use a dot reporter, if no argument is given// a silent reporter will be used.mecha({reporter: 'dot'});Users run your example, and see the message printed above
node examples/awesome.jsBut when run as a test, they see test reports.
mocha examples/awesome.jsYou can therefore include your example files to your test harness,
add a test/examples.js file to your project
// Ensure all examples are workingrequire('../examples/awesome')