Guest User

Untitled

a guest
Jan 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. var Mocha = require('mocha'),
  2. fs = require('fs'),
  3. path = require('path');
  4.  
  5. // Instantiate a Mocha instance.
  6. var mocha = new Mocha();
  7.  
  8. var testDir = 'some/dir/test'
  9.  
  10. // Add each .js file to the mocha instance
  11. fs.readdirSync(testDir).filter(function(file){
  12. // Only keep the .js files
  13. return file.substr(-3) === '.js';
  14.  
  15. }).forEach(function(file){
  16. mocha.addFile(
  17. path.join(testDir, file)
  18. );
  19. });
  20.  
  21. // Run the tests.
  22. mocha.run(function(failures){
  23. process.on('exit', function () {
  24. process.exit(failures); // exit with non-zero status if there were failures
  25. });
  26. });
Add Comment
Please, Sign In to add comment