Fix phantom tests after version bump

It turned out that PhantomShim used puppeteer's version to report
in tests. This caused one of phantomJS tests to fail when the puppeteer
version got bumped.

This patch grants PhantomShim its own version, independent from
puppeteer's. This would make it easier to roll puppeteer.
This commit is contained in:
Andrey Lushnikov 2017-07-28 01:51:05 -07:00
parent 245391cb54
commit 02d4c8819d
2 changed files with 33 additions and 31 deletions

View File

@ -19,6 +19,10 @@ let path = require('path');
let vm = require('vm');
let url = require('url');
const VERSION = [0, 0, 1];
module.exports.version = VERSION;
/**
* @param {!Object} context
* @param {string} scriptPath
@ -82,11 +86,10 @@ module.exports.create = function(context, scriptPath) {
* @return {!{major: number, minor: number, patch: number}}
*/
get version() {
let versionParts = require('../package.json').version.split('.');
return {
major: parseInt(versionParts[0], 10),
minor: parseInt(versionParts[1], 10),
patch: parseInt(versionParts[2], 10),
major: VERSION[0],
minor: VERSION[1],
patch: VERSION[2],
};
},

View File

@ -25,7 +25,6 @@ let WebPage = require('./WebPage');
let WebServer = require('./WebServer');
let child_process = require('child_process');
let Browser = require('..').Browser;
let version = require('../package.json').version;
let argv = require('minimist')(process.argv.slice(2), {
alias: { v: 'version' },
boolean: ['headless'],
@ -33,7 +32,7 @@ let argv = require('minimist')(process.argv.slice(2), {
});
if (argv.version) {
console.log('Puppeteer v' + version);
console.log('PhantomShim v' + Phantom.version.join('.'));
return;
}