Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. const path = require('path');
  2. const glob = require('glob');
  3. const base = path.resolve(__dirname, '../');
  4.  
  5. const allScripts = glob.sync(path.join(__dirname, '../src') + '/**/*.js');
  6.  
  7. const tests = allScripts.filter(s => (/\.test\.js$/).test(s));
  8. const scripts = allScripts.filter(s => !(/\.(test|disabled|unsafe)\./).test(s));
  9.  
  10. const untested = scripts.filter(s => !tests.includes(s.replace(/\.js$/,'.test.js')));
  11.  
  12. if (untested.length) {
  13. console.error('\n\nThe following scripts do not have a test file.');
  14. untested
  15. .map(s => path.resolve(s).replace(base, '').substr(1))
  16. .forEach(s => console.error(` ${s}`));
  17. process.nextTick(() => process.exit(1));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement