Fix tests and puppeteer shim after c08f1447

This patch:
- fixes require statements inside bin/puppeteer.js
- fixes phantom's run_tests.py to correctly refer to puppeteer
This commit is contained in:
Andrey Lushnikov 2017-05-15 00:17:34 -07:00
parent e05fd8c7b9
commit 6c0e3ebe3e
2 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,9 @@
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var Puppeteer = require('..').Browser;
var Browser = require('..').Browser;
var PhatomJs = require('../phantomjs');
var version = require('../package.json').version;
var argv = require('minimist')(process.argv.slice(2), {
alias: { v: 'version' },
boolean: ['headless'],
@ -26,7 +28,7 @@ var argv = require('minimist')(process.argv.slice(2), {
});
if (argv.version) {
console.log('Puppeteer v' + require('./package.json').version);
console.log('Puppeteer v' + version);
return;
}
@ -54,7 +56,6 @@ var browser = new Browser({
headless: argv.headless,
});
var PhatomJs = require('./phantomjs');
var context = PhatomJs.createContext(browser, scriptPath, argv);
var scriptContent = fs.readFileSync(scriptPath, 'utf8');
vm.runInContext(scriptContent, context);

View File

@ -977,7 +977,7 @@ class TestRunner(object):
def init():
base_path = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
phantomjs_exe = os.path.normpath(base_path + '/../../../index.js')
phantomjs_exe = os.path.normpath(base_path + '/../../../bin/puppeteer.js')
if not os.path.isfile(phantomjs_exe):
sys.stdout.write("{} is unavailable, cannot run tests.\n"
.format(phantomjs_exe))