run.js 874 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env node
  2. var lint = require("./lint/lint");
  3. lint.checkDir("mode");
  4. lint.checkDir("lib");
  5. lint.checkDir("addon");
  6. var ok = lint.success();
  7. var files = new (require('node-static').Server)('.');
  8. var server = require('http').createServer(function (req, res) {
  9. req.addListener('end', function () {
  10. files.serve(req, res);
  11. });
  12. }).addListener('error', function (err) {
  13. throw err;
  14. }).listen(3000, function () {
  15. var child_process = require('child_process');
  16. child_process.exec("which phantomjs", function (err) {
  17. if (err) {
  18. console.error("PhantomJS is not installed. Download from http://phantomjs.org");
  19. process.exit(1);
  20. }
  21. var cmd = 'phantomjs test/phantom_driver.js';
  22. child_process.exec(cmd, function (err, stdout) {
  23. server.close();
  24. console.log(stdout);
  25. process.exit(err || !ok ? 1 : 0);
  26. });
  27. });
  28. });