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';
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 =
process.env['PRODUCT'] || process.env['PUPPETEER_PRODUCT'] || 'chrome';
@ -68,9 +57,7 @@ async function setUpProcessVariables() {
let extraLaunchOptions = {};
try {
extraLaunchOptions = JSON.parse(
process.env['EXTRA_LAUNCH_OPTIONS'] || '{}'
);
extraLaunchOptions = JSON.parse(process.env['EXTRA_LAUNCH_OPTIONS'] || '{}');
} catch (error) {
if (isErrorLike(error)) {
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,
alternativeInstall,
headless,
@ -115,10 +111,6 @@ async function setUpProcessVariables() {
protocol,
defaultBrowserOptions,
};
}
(async (): Promise<void> => {
await setUpProcessVariables();
})();
const setupServer = async () => {
const assetsPath = path.join(__dirname, '../assets');