chore: rename revision to buildId (#9721)

This commit is contained in:
Alex Rudenko 2023-02-21 17:15:49 +01:00 committed by GitHub
parent e3d8524738
commit dcd6a3e1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 86 additions and 86 deletions

View File

@ -18,7 +18,7 @@ import ProgressBar from 'progress';
import yargs from 'yargs'; import yargs from 'yargs';
import {hideBin} from 'yargs/helpers'; import {hideBin} from 'yargs/helpers';
import {resolveRevision} from './browsers/browsers.js'; import {resolveBuildId} from './browsers/browsers.js';
import {Browser, BrowserPlatform} from './browsers/types.js'; import {Browser, BrowserPlatform} from './browsers/types.js';
import {detectBrowserPlatform} from './detectPlatform.js'; import {detectBrowserPlatform} from './detectPlatform.js';
import {fetch} from './fetch.js'; import {fetch} from './fetch.js';
@ -27,7 +27,7 @@ import {computeExecutablePath, launch} from './launcher.js';
type InstallArgs = { type InstallArgs = {
browser: { browser: {
name: Browser; name: Browser;
revision: string; buildId: string;
}; };
path?: string; path?: string;
platform?: BrowserPlatform; platform?: BrowserPlatform;
@ -36,7 +36,7 @@ type InstallArgs = {
type LaunchArgs = { type LaunchArgs = {
browser: { browser: {
name: Browser; name: Browser;
revision: string; buildId: string;
}; };
path?: string; path?: string;
platform?: BrowserPlatform; platform?: BrowserPlatform;
@ -62,7 +62,7 @@ export class CLI {
coerce: (opt): InstallArgs['browser'] => { coerce: (opt): InstallArgs['browser'] => {
return { return {
name: this.#parseBrowser(opt), name: this.#parseBrowser(opt),
revision: this.#parseRevision(opt), buildId: this.#parseBuildId(opt),
}; };
}, },
}); });
@ -73,23 +73,23 @@ export class CLI {
if (!args.platform) { if (!args.platform) {
throw new Error(`Could not resolve the current platform`); throw new Error(`Could not resolve the current platform`);
} }
args.browser.revision = await resolveRevision( args.browser.buildId = await resolveBuildId(
args.browser.name, args.browser.name,
args.platform, args.platform,
args.browser.revision args.browser.buildId
); );
await fetch({ await fetch({
browser: args.browser.name, browser: args.browser.name,
revision: args.browser.revision, buildId: args.browser.buildId,
platform: args.platform, platform: args.platform,
cacheDir: args.path ?? this.#cachePath, cacheDir: args.path ?? this.#cachePath,
downloadProgressCallback: this.#makeProgressCallback( downloadProgressCallback: this.#makeProgressCallback(
args.browser.name, args.browser.name,
args.browser.revision args.browser.buildId
), ),
}); });
console.log( console.log(
`${args.browser.name}@${args.browser.revision} downloaded successfully.` `${args.browser.name}@${args.browser.buildId} downloaded successfully.`
); );
} }
) )
@ -114,7 +114,7 @@ export class CLI {
coerce: (opt): LaunchArgs['browser'] => { coerce: (opt): LaunchArgs['browser'] => {
return { return {
name: this.#parseBrowser(opt), name: this.#parseBrowser(opt),
revision: this.#parseRevision(opt), buildId: this.#parseBuildId(opt),
}; };
}, },
}); });
@ -123,7 +123,7 @@ export class CLI {
const args = argv as unknown as LaunchArgs; const args = argv as unknown as LaunchArgs;
const executablePath = computeExecutablePath({ const executablePath = computeExecutablePath({
browser: args.browser.name, browser: args.browser.name,
revision: args.browser.revision, buildId: args.browser.buildId,
cacheDir: args.path ?? this.#cachePath, cacheDir: args.path ?? this.#cachePath,
platform: args.platform, platform: args.platform,
}); });
@ -156,7 +156,7 @@ export class CLI {
return version.split('@').shift() as Browser; return version.split('@').shift() as Browser;
} }
#parseRevision(version: string): string { #parseBuildId(version: string): string {
return version.split('@').pop() ?? 'latest'; return version.split('@').pop() ?? 'latest';
} }
@ -165,13 +165,13 @@ export class CLI {
return `${Math.round(mb * 10) / 10} Mb`; return `${Math.round(mb * 10) / 10} Mb`;
} }
#makeProgressCallback(browser: Browser, revision: string) { #makeProgressCallback(browser: Browser, buildId: string) {
let progressBar: ProgressBar; let progressBar: ProgressBar;
let lastDownloadedBytes = 0; let lastDownloadedBytes = 0;
return (downloadedBytes: number, totalBytes: number) => { return (downloadedBytes: number, totalBytes: number) => {
if (!progressBar) { if (!progressBar) {
progressBar = new ProgressBar( progressBar = new ProgressBar(
`Downloading ${browser} r${revision} - ${this.#toMegabytes( `Downloading ${browser} r${buildId} - ${this.#toMegabytes(
totalBytes totalBytes
)} [:bar] :percent :etas `, )} [:bar] :percent :etas `,
{ {

View File

@ -23,12 +23,12 @@ import {Browser, BrowserPlatform} from './browsers/types.js';
* *
* - rootDir * - rootDir
* -- <browser1> | browserRoot(browser1) * -- <browser1> | browserRoot(browser1)
* ---- <platform>-<revision> | installationDir() * ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-revision * ------ the browser-platform-buildId
* ------ specific structure. * ------ specific structure.
* -- <browser2> | browserRoot(browser2) * -- <browser2> | browserRoot(browser2)
* ---- <platform>-<revision> | installationDir() * ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-revision * ------ the browser-platform-buildId
* ------ specific structure. * ------ specific structure.
* @internal * @internal
*/ */
@ -46,8 +46,8 @@ export class CacheStructure {
installationDir( installationDir(
browser: Browser, browser: Browser,
platform: BrowserPlatform, platform: BrowserPlatform,
revision: string buildId: string
): string { ): string {
return path.join(this.browserRoot(browser), `${platform}-${revision}`); return path.join(this.browserRoot(browser), `${platform}-${buildId}`);
} }
} }

View File

@ -30,7 +30,7 @@ export const executablePathByBrowser = {
export {Browser, BrowserPlatform}; export {Browser, BrowserPlatform};
export async function resolveRevision( export async function resolveBuildId(
browser: Browser, browser: Browser,
platform: BrowserPlatform, platform: BrowserPlatform,
tag: string tag: string
@ -39,14 +39,14 @@ export async function resolveRevision(
case Browser.FIREFOX: case Browser.FIREFOX:
switch (tag as BrowserTag) { switch (tag as BrowserTag) {
case BrowserTag.LATEST: case BrowserTag.LATEST:
return await firefox.resolveRevision('FIREFOX_NIGHTLY'); return await firefox.resolveBuildId('FIREFOX_NIGHTLY');
} }
case Browser.CHROME: case Browser.CHROME:
switch (tag as BrowserTag) { switch (tag as BrowserTag) {
case BrowserTag.LATEST: case BrowserTag.LATEST:
return await chrome.resolveRevision(platform, 'latest'); return await chrome.resolveBuildId(platform, 'latest');
} }
} }
// We assume the tag is the revision if it didn't match any keywords. // We assume the tag is the buildId if it didn't match any keywords.
return tag; return tag;
} }

View File

@ -20,7 +20,7 @@ import {httpRequest} from '../httpUtil.js';
import {BrowserPlatform} from './types.js'; import {BrowserPlatform} from './types.js';
function archive(platform: BrowserPlatform, revision: string): string { function archive(platform: BrowserPlatform, buildId: string): string {
switch (platform) { switch (platform) {
case BrowserPlatform.LINUX: case BrowserPlatform.LINUX:
return 'chrome-linux'; return 'chrome-linux';
@ -30,7 +30,7 @@ function archive(platform: BrowserPlatform, revision: string): string {
case BrowserPlatform.WIN32: case BrowserPlatform.WIN32:
case BrowserPlatform.WIN64: case BrowserPlatform.WIN64:
// Windows archive name changed at r591479. // Windows archive name changed at r591479.
return parseInt(revision, 10) > 591479 ? 'chrome-win' : 'chrome-win32'; return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32';
} }
} }
@ -51,18 +51,18 @@ function folder(platform: BrowserPlatform): string {
export function resolveDownloadUrl( export function resolveDownloadUrl(
platform: BrowserPlatform, platform: BrowserPlatform,
revision: string, buildId: string,
baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots' baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots'
): string { ): string {
return `${baseUrl}/${folder(platform)}/${revision}/${archive( return `${baseUrl}/${folder(platform)}/${buildId}/${archive(
platform, platform,
revision buildId
)}.zip`; )}.zip`;
} }
export function relativeExecutablePath( export function relativeExecutablePath(
platform: BrowserPlatform, platform: BrowserPlatform,
_revision: string _buildId: string
): string { ): string {
switch (platform) { switch (platform) {
case BrowserPlatform.MAC: case BrowserPlatform.MAC:
@ -82,7 +82,7 @@ export function relativeExecutablePath(
} }
} }
export async function resolveRevision( export async function resolveBuildId(
platform: BrowserPlatform, platform: BrowserPlatform,
// We will need it for other channels/keywords. // We will need it for other channels/keywords.
_channel: 'latest' = 'latest' _channel: 'latest' = 'latest'

View File

@ -20,30 +20,30 @@ import {httpRequest} from '../httpUtil.js';
import {BrowserPlatform} from './types.js'; import {BrowserPlatform} from './types.js';
function archive(platform: BrowserPlatform, revision: string): string { function archive(platform: BrowserPlatform, buildId: string): string {
switch (platform) { switch (platform) {
case BrowserPlatform.LINUX: case BrowserPlatform.LINUX:
return `firefox-${revision}.en-US.${platform}-x86_64.tar.bz2`; return `firefox-${buildId}.en-US.${platform}-x86_64.tar.bz2`;
case BrowserPlatform.MAC_ARM: case BrowserPlatform.MAC_ARM:
case BrowserPlatform.MAC: case BrowserPlatform.MAC:
return `firefox-${revision}.en-US.mac.dmg`; return `firefox-${buildId}.en-US.mac.dmg`;
case BrowserPlatform.WIN32: case BrowserPlatform.WIN32:
case BrowserPlatform.WIN64: case BrowserPlatform.WIN64:
return `firefox-${revision}.en-US.${platform}.zip`; return `firefox-${buildId}.en-US.${platform}.zip`;
} }
} }
export function resolveDownloadUrl( export function resolveDownloadUrl(
platform: BrowserPlatform, platform: BrowserPlatform,
revision: string, buildId: string,
baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central' baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central'
): string { ): string {
return `${baseUrl}/${archive(platform, revision)}`; return `${baseUrl}/${archive(platform, buildId)}`;
} }
export function relativeExecutablePath( export function relativeExecutablePath(
platform: BrowserPlatform, platform: BrowserPlatform,
_revision: string _buildId: string
): string { ): string {
switch (platform) { switch (platform) {
case BrowserPlatform.MAC_ARM: case BrowserPlatform.MAC_ARM:
@ -57,7 +57,7 @@ export function relativeExecutablePath(
} }
} }
export async function resolveRevision( export async function resolveBuildId(
channel: 'FIREFOX_NIGHTLY' = 'FIREFOX_NIGHTLY' channel: 'FIREFOX_NIGHTLY' = 'FIREFOX_NIGHTLY'
): Promise<string> { ): Promise<string> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -48,10 +48,10 @@ export interface Options {
*/ */
browser: Browser; browser: Browser;
/** /**
* Determines which revision to dowloand. Revision should uniquely identify * Determines which buildId to dowloand. BuildId should uniquely identify
* binaries and they are used for caching. * binaries and they are used for caching.
*/ */
revision: string; buildId: string;
/** /**
* Provides information about the progress of the download. * Provides information about the progress of the download.
*/ */
@ -64,7 +64,7 @@ export interface Options {
export type InstalledBrowser = { export type InstalledBrowser = {
path: string; path: string;
browser: Browser; browser: Browser;
revision: string; buildId: string;
platform: BrowserPlatform; platform: BrowserPlatform;
}; };
@ -78,7 +78,7 @@ export async function fetch(options: Options): Promise<InstalledBrowser> {
const url = getDownloadUrl( const url = getDownloadUrl(
options.browser, options.browser,
options.platform, options.platform,
options.revision options.buildId
); );
const fileName = url.toString().split('/').pop(); const fileName = url.toString().split('/').pop();
assert(fileName, `A malformed download URL was found: ${url}.`); assert(fileName, `A malformed download URL was found: ${url}.`);
@ -91,14 +91,14 @@ export async function fetch(options: Options): Promise<InstalledBrowser> {
const outputPath = structure.installationDir( const outputPath = structure.installationDir(
options.browser, options.browser,
options.platform, options.platform,
options.revision options.buildId
); );
if (existsSync(outputPath)) { if (existsSync(outputPath)) {
return { return {
path: outputPath, path: outputPath,
browser: options.browser, browser: options.browser,
platform: options.platform, platform: options.platform,
revision: options.revision, buildId: options.buildId,
}; };
} }
try { try {
@ -115,7 +115,7 @@ export async function fetch(options: Options): Promise<InstalledBrowser> {
path: outputPath, path: outputPath,
browser: options.browser, browser: options.browser,
platform: options.platform, platform: options.platform,
revision: options.revision, buildId: options.buildId,
}; };
} }
@ -127,14 +127,14 @@ export async function canFetch(options: Options): Promise<boolean> {
); );
} }
return await headHttpRequest( return await headHttpRequest(
getDownloadUrl(options.browser, options.platform, options.revision) getDownloadUrl(options.browser, options.platform, options.buildId)
); );
} }
function getDownloadUrl( function getDownloadUrl(
browser: Browser, browser: Browser,
platform: BrowserPlatform, platform: BrowserPlatform,
revision: string buildId: string
): URL { ): URL {
return new URL(downloadUrls[browser](platform, revision)); return new URL(downloadUrls[browser](platform, buildId));
} }

View File

@ -48,10 +48,10 @@ export interface Options {
*/ */
browser: Browser; browser: Browser;
/** /**
* Determines which revision to dowloand. Revision should uniquely identify * Determines which buildId to dowloand. BuildId should uniquely identify
* binaries and they are used for caching. * binaries and they are used for caching.
*/ */
revision: string; buildId: string;
} }
export function computeExecutablePath(options: Options): string { export function computeExecutablePath(options: Options): string {
@ -64,11 +64,11 @@ export function computeExecutablePath(options: Options): string {
const installationDir = new CacheStructure(options.cacheDir).installationDir( const installationDir = new CacheStructure(options.cacheDir).installationDir(
options.browser, options.browser,
options.platform, options.platform,
options.revision options.buildId
); );
return path.join( return path.join(
installationDir, installationDir,
executablePathByBrowser[options.browser](options.platform, options.revision) executablePathByBrowser[options.browser](options.platform, options.buildId)
); );
} }

View File

@ -25,8 +25,8 @@ describe('CLI', function () {
this.timeout(90000); this.timeout(90000);
let tmpDir = '/tmp/puppeteer-browsers-test'; let tmpDir = '/tmp/puppeteer-browsers-test';
const testChromeRevision = '1083080'; const testChromeBuildId = '1083080';
const testFirefoxRevision = '111.0a1'; const testFirefoxBuildId = '111.0a1';
beforeEach(() => { beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'puppeteer-browsers-test')); tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'puppeteer-browsers-test'));
@ -41,7 +41,7 @@ describe('CLI', function () {
'npx', 'npx',
'@puppeteer/browsers', '@puppeteer/browsers',
'install', 'install',
`chrome@${testChromeRevision}`, `chrome@${testChromeBuildId}`,
`--path=${tmpDir}`, `--path=${tmpDir}`,
'--platform=linux', '--platform=linux',
]); ]);
@ -50,7 +50,7 @@ describe('CLI', function () {
path.join( path.join(
tmpDir, tmpDir,
'chrome', 'chrome',
`linux-${testChromeRevision}`, `linux-${testChromeBuildId}`,
'chrome-linux' 'chrome-linux'
) )
) )
@ -62,13 +62,13 @@ describe('CLI', function () {
'npx', 'npx',
'@puppeteer/browsers', '@puppeteer/browsers',
'install', 'install',
`firefox@${testFirefoxRevision}`, `firefox@${testFirefoxBuildId}`,
`--path=${tmpDir}`, `--path=${tmpDir}`,
'--platform=linux', '--platform=linux',
]); ]);
assert.ok( assert.ok(
fs.existsSync( fs.existsSync(
path.join(tmpDir, 'firefox', `linux-${testFirefoxRevision}`, 'firefox') path.join(tmpDir, 'firefox', `linux-${testFirefoxBuildId}`, 'firefox')
) )
); );
}); });

View File

@ -30,8 +30,8 @@ import {fetch, canFetch} from '../../lib/cjs/fetch.js';
*/ */
describe('fetch', () => { describe('fetch', () => {
let tmpDir = '/tmp/puppeteer-browsers-test'; let tmpDir = '/tmp/puppeteer-browsers-test';
const testChromeRevision = '1083080'; const testChromeBuildId = '1083080';
const testFirefoxRevision = '111.0a1'; const testFirefoxBuildId = '111.0a1';
beforeEach(() => { beforeEach(() => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'puppeteer-browsers-test')); tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'puppeteer-browsers-test'));
@ -41,42 +41,42 @@ describe('fetch', () => {
fs.rmSync(tmpDir, {recursive: true}); fs.rmSync(tmpDir, {recursive: true});
}); });
it('should check if a revision can be downloaded', async () => { it('should check if a buildId can be downloaded', async () => {
assert.ok( assert.ok(
await canFetch({ await canFetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testChromeRevision, buildId: testChromeBuildId,
}) })
); );
}); });
it('should report if a revision is not downloadable', async () => { it('should report if a buildId is not downloadable', async () => {
assert.strictEqual( assert.strictEqual(
await canFetch({ await canFetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: 'unknown', buildId: 'unknown',
}), }),
false false
); );
}); });
it('should download a revision that is a zip archive', async function () { it('should download a buildId that is a zip archive', async function () {
this.timeout(60000); this.timeout(60000);
const expectedOutputPath = path.join( const expectedOutputPath = path.join(
tmpDir, tmpDir,
'chrome', 'chrome',
`${BrowserPlatform.LINUX}-${testChromeRevision}` `${BrowserPlatform.LINUX}-${testChromeBuildId}`
); );
assert.strictEqual(fs.existsSync(expectedOutputPath), false); assert.strictEqual(fs.existsSync(expectedOutputPath), false);
let browser = await fetch({ let browser = await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testChromeRevision, buildId: testChromeBuildId,
}); });
assert.strictEqual(browser.path, expectedOutputPath); assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath)); assert.ok(fs.existsSync(expectedOutputPath));
@ -85,25 +85,25 @@ describe('fetch', () => {
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testChromeRevision, buildId: testChromeBuildId,
}); });
assert.strictEqual(browser.path, expectedOutputPath); assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath)); assert.ok(fs.existsSync(expectedOutputPath));
}); });
it('should download a revision that is a bzip2 archive', async function () { it('should download a buildId that is a bzip2 archive', async function () {
this.timeout(60000); this.timeout(60000);
const expectedOutputPath = path.join( const expectedOutputPath = path.join(
tmpDir, tmpDir,
'firefox', 'firefox',
`${BrowserPlatform.LINUX}-${testFirefoxRevision}` `${BrowserPlatform.LINUX}-${testFirefoxBuildId}`
); );
assert.strictEqual(fs.existsSync(expectedOutputPath), false); assert.strictEqual(fs.existsSync(expectedOutputPath), false);
const browser = await fetch({ const browser = await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.FIREFOX, browser: Browser.FIREFOX,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testFirefoxRevision, buildId: testFirefoxBuildId,
}); });
assert.strictEqual(browser.path, expectedOutputPath); assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath)); assert.ok(fs.existsSync(expectedOutputPath));
@ -112,20 +112,20 @@ describe('fetch', () => {
// Fetch relies on the `hdiutil` utility on MacOS. // Fetch relies on the `hdiutil` utility on MacOS.
// The utility is not available on other platforms. // The utility is not available on other platforms.
(os.platform() === 'darwin' ? it : it.skip)( (os.platform() === 'darwin' ? it : it.skip)(
'should download a revision that is a dmg archive', 'should download a buildId that is a dmg archive',
async function () { async function () {
this.timeout(120000); this.timeout(120000);
const expectedOutputPath = path.join( const expectedOutputPath = path.join(
tmpDir, tmpDir,
'firefox', 'firefox',
`${BrowserPlatform.MAC}-${testFirefoxRevision}` `${BrowserPlatform.MAC}-${testFirefoxBuildId}`
); );
assert.strictEqual(fs.existsSync(expectedOutputPath), false); assert.strictEqual(fs.existsSync(expectedOutputPath), false);
const browser = await fetch({ const browser = await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.FIREFOX, browser: Browser.FIREFOX,
platform: BrowserPlatform.MAC, platform: BrowserPlatform.MAC,
revision: testFirefoxRevision, buildId: testFirefoxBuildId,
}); });
assert.strictEqual(browser.path, expectedOutputPath); assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath)); assert.ok(fs.existsSync(expectedOutputPath));
@ -195,7 +195,7 @@ describe('fetch', () => {
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testChromeRevision, buildId: testChromeBuildId,
}), }),
true true
); );
@ -209,14 +209,14 @@ describe('fetch', () => {
const expectedOutputPath = path.join( const expectedOutputPath = path.join(
tmpDir, tmpDir,
'chrome', 'chrome',
`${BrowserPlatform.LINUX}-${testChromeRevision}` `${BrowserPlatform.LINUX}-${testChromeBuildId}`
); );
assert.strictEqual(fs.existsSync(expectedOutputPath), false); assert.strictEqual(fs.existsSync(expectedOutputPath), false);
const browser = await fetch({ const browser = await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: testChromeRevision, buildId: testChromeBuildId,
}); });
assert.strictEqual(browser.path, expectedOutputPath); assert.strictEqual(browser.path, expectedOutputPath);
assert.ok(fs.existsSync(expectedOutputPath)); assert.ok(fs.existsSync(expectedOutputPath));

View File

@ -29,7 +29,7 @@ describe('launcher', () => {
computeExecutablePath({ computeExecutablePath({
browser: Browser.CHROME, browser: Browser.CHROME,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: '123', buildId: '123',
cacheDir: 'cache', cacheDir: 'cache',
}), }),
path.join('cache', 'chrome', 'linux-123', 'chrome-linux', 'chrome') path.join('cache', 'chrome', 'linux-123', 'chrome-linux', 'chrome')
@ -41,7 +41,7 @@ describe('launcher', () => {
computeExecutablePath({ computeExecutablePath({
browser: Browser.FIREFOX, browser: Browser.FIREFOX,
platform: BrowserPlatform.LINUX, platform: BrowserPlatform.LINUX,
revision: '123', buildId: '123',
cacheDir: 'cache', cacheDir: 'cache',
}), }),
path.join('cache', 'firefox', 'linux-123', 'firefox', 'firefox') path.join('cache', 'firefox', 'linux-123', 'firefox', 'firefox')
@ -52,7 +52,7 @@ describe('launcher', () => {
this.timeout(60000); this.timeout(60000);
let tmpDir = '/tmp/puppeteer-browsers-test'; let tmpDir = '/tmp/puppeteer-browsers-test';
const testChromeRevision = '1083080'; const testChromeBuildId = '1083080';
beforeEach(async () => { beforeEach(async () => {
tmpDir = fs.mkdtempSync( tmpDir = fs.mkdtempSync(
@ -61,7 +61,7 @@ describe('launcher', () => {
await fetch({ await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
revision: testChromeRevision, buildId: testChromeBuildId,
}); });
}); });
@ -73,7 +73,7 @@ describe('launcher', () => {
const executablePath = computeExecutablePath({ const executablePath = computeExecutablePath({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.CHROME, browser: Browser.CHROME,
revision: testChromeRevision, buildId: testChromeBuildId,
}); });
const process = launch({ const process = launch({
executablePath, executablePath,
@ -91,7 +91,7 @@ describe('launcher', () => {
this.timeout(60000); this.timeout(60000);
let tmpDir = '/tmp/puppeteer-browsers-test'; let tmpDir = '/tmp/puppeteer-browsers-test';
const testFirefoxRevision = '111.0a1'; const testFirefoxBuildId = '111.0a1';
beforeEach(async () => { beforeEach(async () => {
tmpDir = fs.mkdtempSync( tmpDir = fs.mkdtempSync(
@ -100,7 +100,7 @@ describe('launcher', () => {
await fetch({ await fetch({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.FIREFOX, browser: Browser.FIREFOX,
revision: testFirefoxRevision, buildId: testFirefoxBuildId,
}); });
}); });
@ -112,7 +112,7 @@ describe('launcher', () => {
const executablePath = computeExecutablePath({ const executablePath = computeExecutablePath({
cacheDir: tmpDir, cacheDir: tmpDir,
browser: Browser.FIREFOX, browser: Browser.FIREFOX,
revision: testFirefoxRevision, buildId: testFirefoxBuildId,
}); });
const process = launch({ const process = launch({
executablePath, executablePath,