ci: fix mocha utils (#10496)

This commit is contained in:
Alex Rudenko 2023-07-03 11:41:24 +02:00 committed by GitHub
parent d16ca474d3
commit 5a3abb2f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,17 +39,6 @@ import sinon from 'sinon';
import {extendExpectWithToBeGolden} from './utils.js'; import {extendExpectWithToBeGolden} from './utils.js';
let processVariables!: {
product: string;
alternativeInstall: string | boolean;
headless: 'true' | 'false' | 'new';
isHeadless: boolean;
isFirefox: boolean;
isChrome: boolean;
protocol: 'cdp' | 'webDriverBiDi';
defaultBrowserOptions: PuppeteerLaunchOptions;
};
async function setUpProcessVariables() {
const product = const product =
process.env['PRODUCT'] || process.env['PUPPETEER_PRODUCT'] || 'chrome'; process.env['PRODUCT'] || process.env['PUPPETEER_PRODUCT'] || 'chrome';
@ -68,9 +57,7 @@ async function setUpProcessVariables() {
let extraLaunchOptions = {}; let extraLaunchOptions = {};
try { try {
extraLaunchOptions = JSON.parse( extraLaunchOptions = JSON.parse(process.env['EXTRA_LAUNCH_OPTIONS'] || '{}');
process.env['EXTRA_LAUNCH_OPTIONS'] || '{}'
);
} catch (error) { } catch (error) {
if (isErrorLike(error)) { if (isErrorLike(error)) {
console.warn( console.warn(
@ -105,7 +92,16 @@ async function setUpProcessVariables() {
} }
} }
processVariables = { const processVariables: {
product: string;
alternativeInstall: string | boolean;
headless: 'true' | 'false' | 'new';
isHeadless: boolean;
isFirefox: boolean;
isChrome: boolean;
protocol: 'cdp' | 'webDriverBiDi';
defaultBrowserOptions: PuppeteerLaunchOptions;
} = {
product, product,
alternativeInstall, alternativeInstall,
headless, headless,
@ -115,10 +111,6 @@ async function setUpProcessVariables() {
protocol, protocol,
defaultBrowserOptions, defaultBrowserOptions,
}; };
}
(async (): Promise<void> => {
await setUpProcessVariables();
})();
const setupServer = async () => { const setupServer = async () => {
const assetsPath = path.join(__dirname, '../assets'); const assetsPath = path.join(__dirname, '../assets');