ScuttleBot

scuttlebot / tests / e2e / node_modules / playwright / lib / common / configLoader.js
Source Blame History 344 lines
f7eb47b… lmata 1 "use strict";
f7eb47b… lmata 2 var __create = Object.create;
f7eb47b… lmata 3 var __defProp = Object.defineProperty;
f7eb47b… lmata 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
f7eb47b… lmata 5 var __getOwnPropNames = Object.getOwnPropertyNames;
f7eb47b… lmata 6 var __getProtoOf = Object.getPrototypeOf;
f7eb47b… lmata 7 var __hasOwnProp = Object.prototype.hasOwnProperty;
f7eb47b… lmata 8 var __export = (target, all) => {
f7eb47b… lmata 9 for (var name in all)
f7eb47b… lmata 10 __defProp(target, name, { get: all[name], enumerable: true });
f7eb47b… lmata 11 };
f7eb47b… lmata 12 var __copyProps = (to, from, except, desc) => {
f7eb47b… lmata 13 if (from && typeof from === "object" || typeof from === "function") {
f7eb47b… lmata 14 for (let key of __getOwnPropNames(from))
f7eb47b… lmata 15 if (!__hasOwnProp.call(to, key) && key !== except)
f7eb47b… lmata 16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
f7eb47b… lmata 17 }
f7eb47b… lmata 18 return to;
f7eb47b… lmata 19 };
f7eb47b… lmata 20 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
f7eb47b… lmata 21 // If the importer is in node compatibility mode or this is not an ESM
f7eb47b… lmata 22 // file that has been converted to a CommonJS file using a Babel-
f7eb47b… lmata 23 // compatible transform (i.e. "__esModule" has not been set), then set
f7eb47b… lmata 24 // "default" to the CommonJS "module.exports" for node compatibility.
f7eb47b… lmata 25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
f7eb47b… lmata 26 mod
f7eb47b… lmata 27 ));
f7eb47b… lmata 28 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
f7eb47b… lmata 29 var configLoader_exports = {};
f7eb47b… lmata 30 __export(configLoader_exports, {
f7eb47b… lmata 31 defineConfig: () => defineConfig,
f7eb47b… lmata 32 deserializeConfig: () => deserializeConfig,
f7eb47b… lmata 33 loadConfig: () => loadConfig,
f7eb47b… lmata 34 loadConfigFromFile: () => loadConfigFromFile,
f7eb47b… lmata 35 loadEmptyConfigForMergeReports: () => loadEmptyConfigForMergeReports,
f7eb47b… lmata 36 resolveConfigLocation: () => resolveConfigLocation
f7eb47b… lmata 37 });
f7eb47b… lmata 38 module.exports = __toCommonJS(configLoader_exports);
f7eb47b… lmata 39 var import_fs = __toESM(require("fs"));
f7eb47b… lmata 40 var import_path = __toESM(require("path"));
f7eb47b… lmata 41 var import_utils = require("playwright-core/lib/utils");
f7eb47b… lmata 42 var import_transform = require("../transform/transform");
f7eb47b… lmata 43 var import_util = require("../util");
f7eb47b… lmata 44 var import_config = require("./config");
f7eb47b… lmata 45 var import_esmLoaderHost = require("./esmLoaderHost");
f7eb47b… lmata 46 var import_compilationCache = require("../transform/compilationCache");
f7eb47b… lmata 47 const kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
f7eb47b… lmata 48 const defineConfig = (...configs) => {
f7eb47b… lmata 49 let result = configs[0];
f7eb47b… lmata 50 for (let i = 1; i < configs.length; ++i) {
f7eb47b… lmata 51 const config = configs[i];
f7eb47b… lmata 52 const prevProjects = result.projects;
f7eb47b… lmata 53 result = {
f7eb47b… lmata 54 ...result,
f7eb47b… lmata 55 ...config,
f7eb47b… lmata 56 expect: {
f7eb47b… lmata 57 ...result.expect,
f7eb47b… lmata 58 ...config.expect
f7eb47b… lmata 59 },
f7eb47b… lmata 60 use: {
f7eb47b… lmata 61 ...result.use,
f7eb47b… lmata 62 ...config.use
f7eb47b… lmata 63 },
f7eb47b… lmata 64 build: {
f7eb47b… lmata 65 ...result.build,
f7eb47b… lmata 66 ...config.build
f7eb47b… lmata 67 },
f7eb47b… lmata 68 webServer: [
f7eb47b… lmata 69 ...Array.isArray(result.webServer) ? result.webServer : result.webServer ? [result.webServer] : [],
f7eb47b… lmata 70 ...Array.isArray(config.webServer) ? config.webServer : config.webServer ? [config.webServer] : []
f7eb47b… lmata 71 ]
f7eb47b… lmata 72 };
f7eb47b… lmata 73 if (!result.projects && !config.projects)
f7eb47b… lmata 74 continue;
f7eb47b… lmata 75 const projectOverrides = /* @__PURE__ */ new Map();
f7eb47b… lmata 76 for (const project of config.projects || [])
f7eb47b… lmata 77 projectOverrides.set(project.name, project);
f7eb47b… lmata 78 const projects = [];
f7eb47b… lmata 79 for (const project of prevProjects || []) {
f7eb47b… lmata 80 const projectOverride = projectOverrides.get(project.name);
f7eb47b… lmata 81 if (projectOverride) {
f7eb47b… lmata 82 projects.push({
f7eb47b… lmata 83 ...project,
f7eb47b… lmata 84 ...projectOverride,
f7eb47b… lmata 85 use: {
f7eb47b… lmata 86 ...project.use,
f7eb47b… lmata 87 ...projectOverride.use
f7eb47b… lmata 88 }
f7eb47b… lmata 89 });
f7eb47b… lmata 90 projectOverrides.delete(project.name);
f7eb47b… lmata 91 } else {
f7eb47b… lmata 92 projects.push(project);
f7eb47b… lmata 93 }
f7eb47b… lmata 94 }
f7eb47b… lmata 95 projects.push(...projectOverrides.values());
f7eb47b… lmata 96 result.projects = projects;
f7eb47b… lmata 97 }
f7eb47b… lmata 98 result[kDefineConfigWasUsed] = true;
f7eb47b… lmata 99 return result;
f7eb47b… lmata 100 };
f7eb47b… lmata 101 async function deserializeConfig(data) {
f7eb47b… lmata 102 if (data.compilationCache)
f7eb47b… lmata 103 (0, import_compilationCache.addToCompilationCache)(data.compilationCache);
f7eb47b… lmata 104 return await loadConfig(data.location, data.configCLIOverrides, void 0, data.metadata ? JSON.parse(data.metadata) : void 0);
f7eb47b… lmata 105 }
f7eb47b… lmata 106 async function loadUserConfig(location) {
f7eb47b… lmata 107 let object = location.resolvedConfigFile ? await (0, import_transform.requireOrImport)(location.resolvedConfigFile) : {};
f7eb47b… lmata 108 if (object && typeof object === "object" && "default" in object)
f7eb47b… lmata 109 object = object["default"];
f7eb47b… lmata 110 return object;
f7eb47b… lmata 111 }
f7eb47b… lmata 112 async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
f7eb47b… lmata 113 if (!(0, import_esmLoaderHost.registerESMLoader)()) {
f7eb47b… lmata 114 if (location.resolvedConfigFile && (0, import_util.fileIsModule)(location.resolvedConfigFile))
f7eb47b… lmata 115 throw (0, import_util.errorWithFile)(location.resolvedConfigFile, `Playwright requires Node.js 18.19 or higher to load esm modules. Please update your version of Node.js.`);
f7eb47b… lmata 116 }
f7eb47b… lmata 117 (0, import_transform.setSingleTSConfig)(overrides?.tsconfig);
f7eb47b… lmata 118 await (0, import_esmLoaderHost.configureESMLoader)();
f7eb47b… lmata 119 const userConfig = await loadUserConfig(location);
f7eb47b… lmata 120 validateConfig(location.resolvedConfigFile || "<default config>", userConfig);
f7eb47b… lmata 121 const fullConfig = new import_config.FullConfigInternal(location, userConfig, overrides || {}, metadata);
f7eb47b… lmata 122 fullConfig.defineConfigWasUsed = !!userConfig[kDefineConfigWasUsed];
f7eb47b… lmata 123 if (ignoreProjectDependencies) {
f7eb47b… lmata 124 for (const project of fullConfig.projects) {
f7eb47b… lmata 125 project.deps = [];
f7eb47b… lmata 126 project.teardown = void 0;
f7eb47b… lmata 127 }
f7eb47b… lmata 128 }
f7eb47b… lmata 129 const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
f7eb47b… lmata 130 const external = userConfig.build?.external || [];
f7eb47b… lmata 131 (0, import_transform.setTransformConfig)({ babelPlugins, external });
f7eb47b… lmata 132 if (!overrides?.tsconfig)
f7eb47b… lmata 133 (0, import_transform.setSingleTSConfig)(fullConfig?.singleTSConfigPath);
f7eb47b… lmata 134 await (0, import_esmLoaderHost.configureESMLoaderTransformConfig)();
f7eb47b… lmata 135 return fullConfig;
f7eb47b… lmata 136 }
f7eb47b… lmata 137 function validateConfig(file, config) {
f7eb47b… lmata 138 if (typeof config !== "object" || !config)
f7eb47b… lmata 139 throw (0, import_util.errorWithFile)(file, `Configuration file must export a single object`);
f7eb47b… lmata 140 validateProject(file, config, "config");
f7eb47b… lmata 141 if ("forbidOnly" in config && config.forbidOnly !== void 0) {
f7eb47b… lmata 142 if (typeof config.forbidOnly !== "boolean")
f7eb47b… lmata 143 throw (0, import_util.errorWithFile)(file, `config.forbidOnly must be a boolean`);
f7eb47b… lmata 144 }
f7eb47b… lmata 145 if ("globalSetup" in config && config.globalSetup !== void 0) {
f7eb47b… lmata 146 if (Array.isArray(config.globalSetup)) {
f7eb47b… lmata 147 config.globalSetup.forEach((item, index) => {
f7eb47b… lmata 148 if (typeof item !== "string")
f7eb47b… lmata 149 throw (0, import_util.errorWithFile)(file, `config.globalSetup[${index}] must be a string`);
f7eb47b… lmata 150 });
f7eb47b… lmata 151 } else if (typeof config.globalSetup !== "string") {
f7eb47b… lmata 152 throw (0, import_util.errorWithFile)(file, `config.globalSetup must be a string`);
f7eb47b… lmata 153 }
f7eb47b… lmata 154 }
f7eb47b… lmata 155 if ("globalTeardown" in config && config.globalTeardown !== void 0) {
f7eb47b… lmata 156 if (Array.isArray(config.globalTeardown)) {
f7eb47b… lmata 157 config.globalTeardown.forEach((item, index) => {
f7eb47b… lmata 158 if (typeof item !== "string")
f7eb47b… lmata 159 throw (0, import_util.errorWithFile)(file, `config.globalTeardown[${index}] must be a string`);
f7eb47b… lmata 160 });
f7eb47b… lmata 161 } else if (typeof config.globalTeardown !== "string") {
f7eb47b… lmata 162 throw (0, import_util.errorWithFile)(file, `config.globalTeardown must be a string`);
f7eb47b… lmata 163 }
f7eb47b… lmata 164 }
f7eb47b… lmata 165 if ("globalTimeout" in config && config.globalTimeout !== void 0) {
f7eb47b… lmata 166 if (typeof config.globalTimeout !== "number" || config.globalTimeout < 0)
f7eb47b… lmata 167 throw (0, import_util.errorWithFile)(file, `config.globalTimeout must be a non-negative number`);
f7eb47b… lmata 168 }
f7eb47b… lmata 169 if ("grep" in config && config.grep !== void 0) {
f7eb47b… lmata 170 if (Array.isArray(config.grep)) {
f7eb47b… lmata 171 config.grep.forEach((item, index) => {
f7eb47b… lmata 172 if (!(0, import_utils.isRegExp)(item))
f7eb47b… lmata 173 throw (0, import_util.errorWithFile)(file, `config.grep[${index}] must be a RegExp`);
f7eb47b… lmata 174 });
f7eb47b… lmata 175 } else if (!(0, import_utils.isRegExp)(config.grep)) {
f7eb47b… lmata 176 throw (0, import_util.errorWithFile)(file, `config.grep must be a RegExp`);
f7eb47b… lmata 177 }
f7eb47b… lmata 178 }
f7eb47b… lmata 179 if ("grepInvert" in config && config.grepInvert !== void 0) {
f7eb47b… lmata 180 if (Array.isArray(config.grepInvert)) {
f7eb47b… lmata 181 config.grepInvert.forEach((item, index) => {
f7eb47b… lmata 182 if (!(0, import_utils.isRegExp)(item))
f7eb47b… lmata 183 throw (0, import_util.errorWithFile)(file, `config.grepInvert[${index}] must be a RegExp`);
f7eb47b… lmata 184 });
f7eb47b… lmata 185 } else if (!(0, import_utils.isRegExp)(config.grepInvert)) {
f7eb47b… lmata 186 throw (0, import_util.errorWithFile)(file, `config.grepInvert must be a RegExp`);
f7eb47b… lmata 187 }
f7eb47b… lmata 188 }
f7eb47b… lmata 189 if ("maxFailures" in config && config.maxFailures !== void 0) {
f7eb47b… lmata 190 if (typeof config.maxFailures !== "number" || config.maxFailures < 0)
f7eb47b… lmata 191 throw (0, import_util.errorWithFile)(file, `config.maxFailures must be a non-negative number`);
f7eb47b… lmata 192 }
f7eb47b… lmata 193 if ("preserveOutput" in config && config.preserveOutput !== void 0) {
f7eb47b… lmata 194 if (typeof config.preserveOutput !== "string" || !["always", "never", "failures-only"].includes(config.preserveOutput))
f7eb47b… lmata 195 throw (0, import_util.errorWithFile)(file, `config.preserveOutput must be one of "always", "never" or "failures-only"`);
f7eb47b… lmata 196 }
f7eb47b… lmata 197 if ("projects" in config && config.projects !== void 0) {
f7eb47b… lmata 198 if (!Array.isArray(config.projects))
f7eb47b… lmata 199 throw (0, import_util.errorWithFile)(file, `config.projects must be an array`);
f7eb47b… lmata 200 config.projects.forEach((project, index) => {
f7eb47b… lmata 201 validateProject(file, project, `config.projects[${index}]`);
f7eb47b… lmata 202 });
f7eb47b… lmata 203 }
f7eb47b… lmata 204 if ("quiet" in config && config.quiet !== void 0) {
f7eb47b… lmata 205 if (typeof config.quiet !== "boolean")
f7eb47b… lmata 206 throw (0, import_util.errorWithFile)(file, `config.quiet must be a boolean`);
f7eb47b… lmata 207 }
f7eb47b… lmata 208 if ("reporter" in config && config.reporter !== void 0) {
f7eb47b… lmata 209 if (Array.isArray(config.reporter)) {
f7eb47b… lmata 210 config.reporter.forEach((item, index) => {
f7eb47b… lmata 211 if (!Array.isArray(item) || item.length <= 0 || item.length > 2 || typeof item[0] !== "string")
f7eb47b… lmata 212 throw (0, import_util.errorWithFile)(file, `config.reporter[${index}] must be a tuple [name, optionalArgument]`);
f7eb47b… lmata 213 });
f7eb47b… lmata 214 } else if (typeof config.reporter !== "string") {
f7eb47b… lmata 215 throw (0, import_util.errorWithFile)(file, `config.reporter must be a string`);
f7eb47b… lmata 216 }
f7eb47b… lmata 217 }
f7eb47b… lmata 218 if ("reportSlowTests" in config && config.reportSlowTests !== void 0 && config.reportSlowTests !== null) {
f7eb47b… lmata 219 if (!config.reportSlowTests || typeof config.reportSlowTests !== "object")
f7eb47b… lmata 220 throw (0, import_util.errorWithFile)(file, `config.reportSlowTests must be an object`);
f7eb47b… lmata 221 if (!("max" in config.reportSlowTests) || typeof config.reportSlowTests.max !== "number" || config.reportSlowTests.max < 0)
f7eb47b… lmata 222 throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.max must be a non-negative number`);
f7eb47b… lmata 223 if (!("threshold" in config.reportSlowTests) || typeof config.reportSlowTests.threshold !== "number" || config.reportSlowTests.threshold < 0)
f7eb47b… lmata 224 throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.threshold must be a non-negative number`);
f7eb47b… lmata 225 }
f7eb47b… lmata 226 if ("shard" in config && config.shard !== void 0 && config.shard !== null) {
f7eb47b… lmata 227 if (!config.shard || typeof config.shard !== "object")
f7eb47b… lmata 228 throw (0, import_util.errorWithFile)(file, `config.shard must be an object`);
f7eb47b… lmata 229 if (!("total" in config.shard) || typeof config.shard.total !== "number" || config.shard.total < 1)
f7eb47b… lmata 230 throw (0, import_util.errorWithFile)(file, `config.shard.total must be a positive number`);
f7eb47b… lmata 231 if (!("current" in config.shard) || typeof config.shard.current !== "number" || config.shard.current < 1 || config.shard.current > config.shard.total)
f7eb47b… lmata 232 throw (0, import_util.errorWithFile)(file, `config.shard.current must be a positive number, not greater than config.shard.total`);
f7eb47b… lmata 233 }
f7eb47b… lmata 234 if ("updateSnapshots" in config && config.updateSnapshots !== void 0) {
f7eb47b… lmata 235 if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
f7eb47b… lmata 236 throw (0, import_util.errorWithFile)(file, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
f7eb47b… lmata 237 }
f7eb47b… lmata 238 if ("tsconfig" in config && config.tsconfig !== void 0) {
f7eb47b… lmata 239 if (typeof config.tsconfig !== "string")
f7eb47b… lmata 240 throw (0, import_util.errorWithFile)(file, `config.tsconfig must be a string`);
f7eb47b… lmata 241 if (!import_fs.default.existsSync(import_path.default.resolve(file, "..", config.tsconfig)))
f7eb47b… lmata 242 throw (0, import_util.errorWithFile)(file, `config.tsconfig does not exist`);
f7eb47b… lmata 243 }
f7eb47b… lmata 244 }
f7eb47b… lmata 245 function validateProject(file, project, title) {
f7eb47b… lmata 246 if (typeof project !== "object" || !project)
f7eb47b… lmata 247 throw (0, import_util.errorWithFile)(file, `${title} must be an object`);
f7eb47b… lmata 248 if ("name" in project && project.name !== void 0) {
f7eb47b… lmata 249 if (typeof project.name !== "string")
f7eb47b… lmata 250 throw (0, import_util.errorWithFile)(file, `${title}.name must be a string`);
f7eb47b… lmata 251 }
f7eb47b… lmata 252 if ("outputDir" in project && project.outputDir !== void 0) {
f7eb47b… lmata 253 if (typeof project.outputDir !== "string")
f7eb47b… lmata 254 throw (0, import_util.errorWithFile)(file, `${title}.outputDir must be a string`);
f7eb47b… lmata 255 }
f7eb47b… lmata 256 if ("repeatEach" in project && project.repeatEach !== void 0) {
f7eb47b… lmata 257 if (typeof project.repeatEach !== "number" || project.repeatEach < 0)
f7eb47b… lmata 258 throw (0, import_util.errorWithFile)(file, `${title}.repeatEach must be a non-negative number`);
f7eb47b… lmata 259 }
f7eb47b… lmata 260 if ("retries" in project && project.retries !== void 0) {
f7eb47b… lmata 261 if (typeof project.retries !== "number" || project.retries < 0)
f7eb47b… lmata 262 throw (0, import_util.errorWithFile)(file, `${title}.retries must be a non-negative number`);
f7eb47b… lmata 263 }
f7eb47b… lmata 264 if ("testDir" in project && project.testDir !== void 0) {
f7eb47b… lmata 265 if (typeof project.testDir !== "string")
f7eb47b… lmata 266 throw (0, import_util.errorWithFile)(file, `${title}.testDir must be a string`);
f7eb47b… lmata 267 }
f7eb47b… lmata 268 for (const prop of ["testIgnore", "testMatch"]) {
f7eb47b… lmata 269 if (prop in project && project[prop] !== void 0) {
f7eb47b… lmata 270 const value = project[prop];
f7eb47b… lmata 271 if (Array.isArray(value)) {
f7eb47b… lmata 272 value.forEach((item, index) => {
f7eb47b… lmata 273 if (typeof item !== "string" && !(0, import_utils.isRegExp)(item))
f7eb47b… lmata 274 throw (0, import_util.errorWithFile)(file, `${title}.${prop}[${index}] must be a string or a RegExp`);
f7eb47b… lmata 275 });
f7eb47b… lmata 276 } else if (typeof value !== "string" && !(0, import_utils.isRegExp)(value)) {
f7eb47b… lmata 277 throw (0, import_util.errorWithFile)(file, `${title}.${prop} must be a string or a RegExp`);
f7eb47b… lmata 278 }
f7eb47b… lmata 279 }
f7eb47b… lmata 280 }
f7eb47b… lmata 281 if ("timeout" in project && project.timeout !== void 0) {
f7eb47b… lmata 282 if (typeof project.timeout !== "number" || project.timeout < 0)
f7eb47b… lmata 283 throw (0, import_util.errorWithFile)(file, `${title}.timeout must be a non-negative number`);
f7eb47b… lmata 284 }
f7eb47b… lmata 285 if ("use" in project && project.use !== void 0) {
f7eb47b… lmata 286 if (!project.use || typeof project.use !== "object")
f7eb47b… lmata 287 throw (0, import_util.errorWithFile)(file, `${title}.use must be an object`);
f7eb47b… lmata 288 }
f7eb47b… lmata 289 if ("ignoreSnapshots" in project && project.ignoreSnapshots !== void 0) {
f7eb47b… lmata 290 if (typeof project.ignoreSnapshots !== "boolean")
f7eb47b… lmata 291 throw (0, import_util.errorWithFile)(file, `${title}.ignoreSnapshots must be a boolean`);
f7eb47b… lmata 292 }
f7eb47b… lmata 293 if ("workers" in project && project.workers !== void 0) {
f7eb47b… lmata 294 if (typeof project.workers === "number" && project.workers <= 0)
f7eb47b… lmata 295 throw (0, import_util.errorWithFile)(file, `${title}.workers must be a positive number`);
f7eb47b… lmata 296 else if (typeof project.workers === "string" && !project.workers.endsWith("%"))
f7eb47b… lmata 297 throw (0, import_util.errorWithFile)(file, `${title}.workers must be a number or percentage`);
f7eb47b… lmata 298 }
f7eb47b… lmata 299 }
f7eb47b… lmata 300 function resolveConfigLocation(configFile) {
f7eb47b… lmata 301 const configFileOrDirectory = configFile ? import_path.default.resolve(process.cwd(), configFile) : process.cwd();
f7eb47b… lmata 302 const resolvedConfigFile = resolveConfigFile(configFileOrDirectory);
f7eb47b… lmata 303 return {
f7eb47b… lmata 304 resolvedConfigFile,
f7eb47b… lmata 305 configDir: resolvedConfigFile ? import_path.default.dirname(resolvedConfigFile) : configFileOrDirectory
f7eb47b… lmata 306 };
f7eb47b… lmata 307 }
f7eb47b… lmata 308 function resolveConfigFile(configFileOrDirectory) {
f7eb47b… lmata 309 const resolveConfig = (configFile) => {
f7eb47b… lmata 310 if (import_fs.default.existsSync(configFile))
f7eb47b… lmata 311 return configFile;
f7eb47b… lmata 312 };
f7eb47b… lmata 313 const resolveConfigFileFromDirectory = (directory) => {
f7eb47b… lmata 314 for (const ext of [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"]) {
f7eb47b… lmata 315 const configFile = resolveConfig(import_path.default.resolve(directory, "playwright.config" + ext));
f7eb47b… lmata 316 if (configFile)
f7eb47b… lmata 317 return configFile;
f7eb47b… lmata 318 }
f7eb47b… lmata 319 };
f7eb47b… lmata 320 if (!import_fs.default.existsSync(configFileOrDirectory))
f7eb47b… lmata 321 throw new Error(`${configFileOrDirectory} does not exist`);
f7eb47b… lmata 322 if (import_fs.default.statSync(configFileOrDirectory).isDirectory()) {
f7eb47b… lmata 323 const configFile = resolveConfigFileFromDirectory(configFileOrDirectory);
f7eb47b… lmata 324 if (configFile)
f7eb47b… lmata 325 return configFile;
f7eb47b… lmata 326 return void 0;
f7eb47b… lmata 327 }
f7eb47b… lmata 328 return configFileOrDirectory;
f7eb47b… lmata 329 }
f7eb47b… lmata 330 async function loadConfigFromFile(configFile, overrides, ignoreDeps) {
f7eb47b… lmata 331 return await loadConfig(resolveConfigLocation(configFile), overrides, ignoreDeps);
f7eb47b… lmata 332 }
f7eb47b… lmata 333 async function loadEmptyConfigForMergeReports() {
f7eb47b… lmata 334 return await loadConfig({ configDir: process.cwd() });
f7eb47b… lmata 335 }
f7eb47b… lmata 336 // Annotate the CommonJS export names for ESM import in node:
f7eb47b… lmata 337 0 && (module.exports = {
f7eb47b… lmata 338 defineConfig,
f7eb47b… lmata 339 deserializeConfig,
f7eb47b… lmata 340 loadConfig,
f7eb47b… lmata 341 loadConfigFromFile,
f7eb47b… lmata 342 loadEmptyConfigForMergeReports,
f7eb47b… lmata 343 resolveConfigLocation
f7eb47b… lmata 344 });

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button