index.js 791 B

12345678910111213141516171819202122232425262728293031323334
  1. var fs = require("fs");
  2. var path = require("path");
  3. var childProcess = require("child_process")
  4. var Benchmark = require("benchmark");
  5. var Connection = require("../lib/tedious").Connection;
  6. var Request = require("../lib/tedious").Request;
  7. var types = ["query", "token-parser"];
  8. var tests = [];
  9. types.forEach(function(type) {
  10. var dir = path.join(__dirname, type);
  11. tests.push.apply(tests, fs.readdirSync(dir).map(function(file) {
  12. return path.join(dir, file);
  13. }));
  14. });
  15. runBenchmarks();
  16. function runBenchmarks() {
  17. var test = tests.shift();
  18. if (!test)
  19. return;
  20. var child = childProcess.spawn(process.execPath, [ test ], { stdio: 'inherit' });
  21. child.on('close', function(code) {
  22. if (code) {
  23. process.exit(code);
  24. } else {
  25. runBenchmarks();
  26. }
  27. });
  28. }