unittest.js 817 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const path = require('path');
  2. const { spawnSync } = require('child_process');
  3. const packages = [
  4. 'babel-plugin-import-regenerator',
  5. 'cli',
  6. //'compiler-babel',
  7. 'compiler-less',
  8. 'compiler-sass',
  9. //'compiler-stylus',
  10. //'compiler-typescript',
  11. 'core',
  12. 'plugin-define'
  13. //'plugin-eslint',
  14. //'plugin-uglifyjs',
  15. //'redux',
  16. //'use-promisify',
  17. //'x',
  18. ];
  19. function testAll(pkgs) {
  20. if (pkgs.length === 0) {
  21. pkgs = packages;
  22. }
  23. pkgs.forEach(pkg => {
  24. testOne(pkg);
  25. });
  26. }
  27. function testOne(name) {
  28. process.env.FORCE_COLOR = 1;
  29. spawnSync('npm', ['run', 'test'], {
  30. cwd: path.join(process.cwd(), 'packages', name),
  31. env: process.env,
  32. stdio: 'inherit'
  33. });
  34. }
  35. // eslint-disable-next-line no-unused-vars
  36. (function main([bin, file, ...args]) {
  37. testAll(args);
  38. })(process.argv);