run.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  3. Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  12. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  13. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  14. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  15. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  17. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  19. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  20. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. */
  22. /*jslint node:true */
  23. (function () {
  24. 'use strict';
  25. var child = require('child_process'),
  26. nodejs = '"' + process.execPath + '"',
  27. ret = 0,
  28. suites,
  29. index;
  30. suites = [
  31. 'runner',
  32. 'compat'
  33. ];
  34. function nextTest() {
  35. var suite = suites[index];
  36. if (index < suites.length) {
  37. child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) {
  38. if (stdout) {
  39. process.stdout.write(suite + ': ' + stdout);
  40. }
  41. if (stderr) {
  42. process.stderr.write(suite + ': ' + stderr);
  43. }
  44. if (err) {
  45. ret = err.code;
  46. }
  47. index += 1;
  48. nextTest();
  49. });
  50. } else {
  51. process.exit(ret);
  52. }
  53. }
  54. index = 0;
  55. nextTest();
  56. }());