ensure running slimerjs doesn't require phantomjs

This commit is contained in:
Keith Cirkel 2016-01-19 15:18:52 +00:00
parent d49a94d49c
commit a476d1f3b4
1 changed files with 12 additions and 4 deletions

View File

@ -11,6 +11,7 @@ var crypto = require('crypto'),
path = require('path'),
async = require('async'),
phantomjsPath = require('phantomjs').path,
slimerPath = require('slimerjs').path,
childProcess = require('child_process'),
fileHelper = require('./fileHelpers'),
winston = require('winston'),
@ -364,7 +365,13 @@ module.exports = {
async.parallel([
function(callback) {
childProcess.execFile(config.phantomjsPath || phantomjsPath, ['--version'], {
var path = '';
if (config.headless === 'slimerjs') {
path = config.slimerPath || slimerPath
} else {
path = config.phantomjsPath || phantomjsPath
}
childProcess.execFile(path, ['--version'], {
timeout: 120000
}, function(err, stdout) {
if (err) {
@ -393,12 +400,13 @@ module.exports = {
}
var osVersion = os.platform() + ' ' + os.release();
var phantomjsVersion = results[0];
var headlessVersion = results[0];
var javaVersion = results[1];
var headlessName = config.headless === 'slimerjs' ? 'SlimerJS' : 'PhantomJS';
log.info(
'OS: \'%s\', Node.js: \'%s\', sitespeed.io: \'%s\', PhantomJS: \'%s\', java: \'%s\', browsertime: \'%s\'',
osVersion, process.version, sitespeedVersion, phantomjsVersion, javaVersion, browserTimeVersion);
'OS: \'%s\', Node.js: \'%s\', sitespeed.io: \'%s\', %s: \'%s\', java: \'%s\', browsertime: \'%s\'',
osVersion, process.version, sitespeedVersion, headlessName, headlessVersion, javaVersion, browserTimeVersion);
return cb();
});