feat: initial commit of Railtrack Pro prototype with complete test suite
This commit is contained in:
commit
40500bb503
7790 files changed
+986332
No files matched your search
+282
@@ -0,0 +1,282 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var config_exports = {};
|
||||
__export(config_exports, {
|
||||
FullConfigInternal: () => FullConfigInternal,
|
||||
FullProjectInternal: () => FullProjectInternal,
|
||||
builtInReporters: () => builtInReporters,
|
||||
defaultGrep: () => defaultGrep,
|
||||
defaultReporter: () => defaultReporter,
|
||||
defaultTimeout: () => defaultTimeout,
|
||||
getProjectId: () => getProjectId,
|
||||
takeFirst: () => takeFirst,
|
||||
toReporters: () => toReporters
|
||||
});
|
||||
module.exports = __toCommonJS(config_exports);
|
||||
var import_fs = __toESM(require("fs"));
|
||||
var import_os = __toESM(require("os"));
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_util = require("../util");
|
||||
const defaultTimeout = 3e4;
|
||||
class FullConfigInternal {
|
||||
constructor(location, userConfig, configCLIOverrides, metadata) {
|
||||
this.projects = [];
|
||||
this.cliArgs = [];
|
||||
this.cliListOnly = false;
|
||||
this.preOnlyTestFilters = [];
|
||||
this.postShardTestFilters = [];
|
||||
this.defineConfigWasUsed = false;
|
||||
this.globalSetups = [];
|
||||
this.globalTeardowns = [];
|
||||
if (configCLIOverrides.projects && userConfig.projects)
|
||||
throw new Error(`Cannot use --browser option when configuration file defines projects. Specify browserName in the projects instead.`);
|
||||
const { resolvedConfigFile, configDir } = location;
|
||||
const packageJsonPath = (0, import_util.getPackageJsonPath)(configDir);
|
||||
const packageJsonDir = packageJsonPath ? import_path.default.dirname(packageJsonPath) : process.cwd();
|
||||
this.configDir = configDir;
|
||||
this.configCLIOverrides = configCLIOverrides;
|
||||
const privateConfiguration = userConfig["@playwright/test"];
|
||||
this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
|
||||
this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
|
||||
this.captureGitInfo = userConfig.captureGitInfo;
|
||||
this.failOnFlakyTests = takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false);
|
||||
this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
||||
this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
|
||||
userConfig.metadata = userConfig.metadata || {};
|
||||
const globalTags = Array.isArray(userConfig.tag) ? userConfig.tag : userConfig.tag ? [userConfig.tag] : [];
|
||||
for (const tag of globalTags) {
|
||||
if (tag[0] !== "@")
|
||||
throw new Error(`Tag must start with "@" symbol, got "${tag}" instead.`);
|
||||
}
|
||||
this.config = {
|
||||
configFile: resolvedConfigFile,
|
||||
rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
|
||||
forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false),
|
||||
fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false),
|
||||
globalSetup: this.globalSetups[0] ?? null,
|
||||
globalTeardown: this.globalTeardowns[0] ?? null,
|
||||
globalTimeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.globalTimeout, userConfig.globalTimeout, 0),
|
||||
grep: takeFirst(userConfig.grep, defaultGrep),
|
||||
grepInvert: takeFirst(userConfig.grepInvert, null),
|
||||
maxFailures: takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.maxFailures, userConfig.maxFailures, 0),
|
||||
metadata: metadata ?? userConfig.metadata,
|
||||
preserveOutput: takeFirst(userConfig.preserveOutput, "always"),
|
||||
projects: [],
|
||||
quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
|
||||
reporter: takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]),
|
||||
reportSlowTests: takeFirst(userConfig.reportSlowTests, {
|
||||
max: 5,
|
||||
threshold: 3e5
|
||||
/* 5 minutes */
|
||||
}),
|
||||
// @ts-expect-error runAgents is hidden
|
||||
runAgents: takeFirst(configCLIOverrides.runAgents, "none"),
|
||||
shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
|
||||
tags: globalTags,
|
||||
updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "missing"),
|
||||
updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, "patch"),
|
||||
version: require("../../package.json").version,
|
||||
workers: resolveWorkers(takeFirst(configCLIOverrides.debug || configCLIOverrides.pause ? 1 : void 0, configCLIOverrides.workers, userConfig.workers, "50%")),
|
||||
webServer: null
|
||||
};
|
||||
for (const key in userConfig) {
|
||||
if (key.startsWith("@"))
|
||||
this.config[key] = userConfig[key];
|
||||
}
|
||||
this.config[configInternalSymbol] = this;
|
||||
const webServers = takeFirst(userConfig.webServer, null);
|
||||
if (Array.isArray(webServers)) {
|
||||
this.config.webServer = null;
|
||||
this.webServers = webServers;
|
||||
} else if (webServers) {
|
||||
this.config.webServer = webServers;
|
||||
this.webServers = [webServers];
|
||||
} else {
|
||||
this.webServers = [];
|
||||
}
|
||||
const projectConfigs = configCLIOverrides.projects || userConfig.projects || [{ ...userConfig, workers: void 0 }];
|
||||
this.projects = projectConfigs.map((p) => new FullProjectInternal(configDir, userConfig, this, p, this.configCLIOverrides, packageJsonDir));
|
||||
resolveProjectDependencies(this.projects);
|
||||
this._assignUniqueProjectIds(this.projects);
|
||||
this.config.projects = this.projects.map((p) => p.project);
|
||||
}
|
||||
_assignUniqueProjectIds(projects) {
|
||||
const usedNames = /* @__PURE__ */ new Set();
|
||||
for (const p of projects) {
|
||||
const name = p.project.name || "";
|
||||
for (let i = 0; i < projects.length; ++i) {
|
||||
const candidate = name + (i ? i : "");
|
||||
if (usedNames.has(candidate))
|
||||
continue;
|
||||
p.id = candidate;
|
||||
p.project.__projectId = p.id;
|
||||
usedNames.add(candidate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class FullProjectInternal {
|
||||
constructor(configDir, config, fullConfig, projectConfig, configCLIOverrides, packageJsonDir) {
|
||||
this.id = "";
|
||||
this.deps = [];
|
||||
this.fullConfig = fullConfig;
|
||||
const testDir = takeFirst(pathResolve(configDir, projectConfig.testDir), pathResolve(configDir, config.testDir), fullConfig.configDir);
|
||||
this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate);
|
||||
this.project = {
|
||||
grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
|
||||
grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
|
||||
outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), import_path.default.join(packageJsonDir, "test-results")),
|
||||
// Note: we either apply the cli override for repeatEach or not, depending on whether the
|
||||
// project is top-level vs dependency. See collectProjectsAndTestFiles in loadUtils.
|
||||
repeatEach: takeFirst(projectConfig.repeatEach, config.repeatEach, 1),
|
||||
retries: takeFirst(configCLIOverrides.retries, projectConfig.retries, config.retries, 0),
|
||||
metadata: takeFirst(projectConfig.metadata, config.metadata, {}),
|
||||
name: takeFirst(projectConfig.name, config.name, ""),
|
||||
testDir,
|
||||
snapshotDir: takeFirst(pathResolve(configDir, projectConfig.snapshotDir), pathResolve(configDir, config.snapshotDir), testDir),
|
||||
testIgnore: takeFirst(projectConfig.testIgnore, config.testIgnore, []),
|
||||
testMatch: takeFirst(projectConfig.testMatch, config.testMatch, "**/*.@(spec|test).?(c|m)[jt]s?(x)"),
|
||||
timeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.timeout, projectConfig.timeout, config.timeout, defaultTimeout),
|
||||
use: (0, import_util.mergeObjects)(config.use, projectConfig.use, configCLIOverrides.use),
|
||||
dependencies: projectConfig.dependencies || [],
|
||||
teardown: projectConfig.teardown
|
||||
};
|
||||
this.fullyParallel = takeFirst(configCLIOverrides.fullyParallel, projectConfig.fullyParallel, config.fullyParallel, void 0);
|
||||
this.expect = takeFirst(projectConfig.expect, config.expect, {});
|
||||
if (this.expect.toHaveScreenshot?.stylePath) {
|
||||
const stylePaths = Array.isArray(this.expect.toHaveScreenshot.stylePath) ? this.expect.toHaveScreenshot.stylePath : [this.expect.toHaveScreenshot.stylePath];
|
||||
this.expect.toHaveScreenshot.stylePath = stylePaths.map((stylePath) => import_path.default.resolve(configDir, stylePath));
|
||||
}
|
||||
this.respectGitIgnore = takeFirst(projectConfig.respectGitIgnore, config.respectGitIgnore, !projectConfig.testDir && !config.testDir);
|
||||
this.ignoreSnapshots = takeFirst(configCLIOverrides.ignoreSnapshots, projectConfig.ignoreSnapshots, config.ignoreSnapshots, false);
|
||||
this.workers = projectConfig.workers ? resolveWorkers(projectConfig.workers) : void 0;
|
||||
if (configCLIOverrides.debug && this.workers)
|
||||
this.workers = 1;
|
||||
}
|
||||
}
|
||||
function takeFirst(...args) {
|
||||
for (const arg of args) {
|
||||
if (arg !== void 0)
|
||||
return arg;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
function pathResolve(baseDir, relative) {
|
||||
if (!relative)
|
||||
return void 0;
|
||||
return import_path.default.resolve(baseDir, relative);
|
||||
}
|
||||
function resolveReporters(reporters, rootDir) {
|
||||
return toReporters(reporters)?.map(([id, arg]) => {
|
||||
if (builtInReporters.includes(id))
|
||||
return [id, arg];
|
||||
return [require.resolve(id, { paths: [rootDir] }), arg];
|
||||
});
|
||||
}
|
||||
function resolveWorkers(workers) {
|
||||
if (typeof workers === "string") {
|
||||
if (workers.endsWith("%")) {
|
||||
const cpus = import_os.default.cpus().length;
|
||||
return Math.max(1, Math.floor(cpus * (parseInt(workers, 10) / 100)));
|
||||
}
|
||||
const parsedWorkers = parseInt(workers, 10);
|
||||
if (isNaN(parsedWorkers))
|
||||
throw new Error(`Workers ${workers} must be a number or percentage.`);
|
||||
return parsedWorkers;
|
||||
}
|
||||
return workers;
|
||||
}
|
||||
function resolveProjectDependencies(projects) {
|
||||
const teardownSet = /* @__PURE__ */ new Set();
|
||||
for (const project of projects) {
|
||||
for (const dependencyName of project.project.dependencies) {
|
||||
const dependencies = projects.filter((p) => p.project.name === dependencyName);
|
||||
if (!dependencies.length)
|
||||
throw new Error(`Project '${project.project.name}' depends on unknown project '${dependencyName}'`);
|
||||
if (dependencies.length > 1)
|
||||
throw new Error(`Project dependencies should have unique names, reading ${dependencyName}`);
|
||||
project.deps.push(...dependencies);
|
||||
}
|
||||
if (project.project.teardown) {
|
||||
const teardowns = projects.filter((p) => p.project.name === project.project.teardown);
|
||||
if (!teardowns.length)
|
||||
throw new Error(`Project '${project.project.name}' has unknown teardown project '${project.project.teardown}'`);
|
||||
if (teardowns.length > 1)
|
||||
throw new Error(`Project teardowns should have unique names, reading ${project.project.teardown}`);
|
||||
const teardown = teardowns[0];
|
||||
project.teardown = teardown;
|
||||
teardownSet.add(teardown);
|
||||
}
|
||||
}
|
||||
for (const teardown of teardownSet) {
|
||||
if (teardown.deps.length)
|
||||
throw new Error(`Teardown project ${teardown.project.name} must not have dependencies`);
|
||||
}
|
||||
for (const project of projects) {
|
||||
for (const dep of project.deps) {
|
||||
if (teardownSet.has(dep))
|
||||
throw new Error(`Project ${project.project.name} must not depend on a teardown project ${dep.project.name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function toReporters(reporters) {
|
||||
if (!reporters)
|
||||
return;
|
||||
if (typeof reporters === "string")
|
||||
return [[reporters]];
|
||||
return reporters;
|
||||
}
|
||||
const builtInReporters = ["list", "line", "dot", "json", "junit", "null", "github", "html", "blob"];
|
||||
function resolveScript(id, rootDir) {
|
||||
if (!id)
|
||||
return void 0;
|
||||
const localPath = import_path.default.resolve(rootDir, id);
|
||||
if (import_fs.default.existsSync(localPath))
|
||||
return localPath;
|
||||
return require.resolve(id, { paths: [rootDir] });
|
||||
}
|
||||
const defaultGrep = /.*/;
|
||||
const defaultReporter = process.env.CI ? "dot" : "list";
|
||||
const configInternalSymbol = Symbol("configInternalSymbol");
|
||||
function getProjectId(project) {
|
||||
return project.__projectId;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FullConfigInternal,
|
||||
FullProjectInternal,
|
||||
builtInReporters,
|
||||
defaultGrep,
|
||||
defaultReporter,
|
||||
defaultTimeout,
|
||||
getProjectId,
|
||||
takeFirst,
|
||||
toReporters
|
||||
});
|
||||
+344
@@ -0,0 +1,344 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var configLoader_exports = {};
|
||||
__export(configLoader_exports, {
|
||||
defineConfig: () => defineConfig,
|
||||
deserializeConfig: () => deserializeConfig,
|
||||
loadConfig: () => loadConfig,
|
||||
loadConfigFromFile: () => loadConfigFromFile,
|
||||
loadEmptyConfigForMergeReports: () => loadEmptyConfigForMergeReports,
|
||||
resolveConfigLocation: () => resolveConfigLocation
|
||||
});
|
||||
module.exports = __toCommonJS(configLoader_exports);
|
||||
var import_fs = __toESM(require("fs"));
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_transform = require("../transform/transform");
|
||||
var import_util = require("../util");
|
||||
var import_config = require("./config");
|
||||
var import_esmLoaderHost = require("./esmLoaderHost");
|
||||
var import_compilationCache = require("../transform/compilationCache");
|
||||
const kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
|
||||
const defineConfig = (...configs) => {
|
||||
let result = configs[0];
|
||||
for (let i = 1; i < configs.length; ++i) {
|
||||
const config = configs[i];
|
||||
const prevProjects = result.projects;
|
||||
result = {
|
||||
...result,
|
||||
...config,
|
||||
expect: {
|
||||
...result.expect,
|
||||
...config.expect
|
||||
},
|
||||
use: {
|
||||
...result.use,
|
||||
...config.use
|
||||
},
|
||||
build: {
|
||||
...result.build,
|
||||
...config.build
|
||||
},
|
||||
webServer: [
|
||||
...Array.isArray(result.webServer) ? result.webServer : result.webServer ? [result.webServer] : [],
|
||||
...Array.isArray(config.webServer) ? config.webServer : config.webServer ? [config.webServer] : []
|
||||
]
|
||||
};
|
||||
if (!result.projects && !config.projects)
|
||||
continue;
|
||||
const projectOverrides = /* @__PURE__ */ new Map();
|
||||
for (const project of config.projects || [])
|
||||
projectOverrides.set(project.name, project);
|
||||
const projects = [];
|
||||
for (const project of prevProjects || []) {
|
||||
const projectOverride = projectOverrides.get(project.name);
|
||||
if (projectOverride) {
|
||||
projects.push({
|
||||
...project,
|
||||
...projectOverride,
|
||||
use: {
|
||||
...project.use,
|
||||
...projectOverride.use
|
||||
}
|
||||
});
|
||||
projectOverrides.delete(project.name);
|
||||
} else {
|
||||
projects.push(project);
|
||||
}
|
||||
}
|
||||
projects.push(...projectOverrides.values());
|
||||
result.projects = projects;
|
||||
}
|
||||
result[kDefineConfigWasUsed] = true;
|
||||
return result;
|
||||
};
|
||||
async function deserializeConfig(data) {
|
||||
if (data.compilationCache)
|
||||
(0, import_compilationCache.addToCompilationCache)(data.compilationCache);
|
||||
return await loadConfig(data.location, data.configCLIOverrides, void 0, data.metadata ? JSON.parse(data.metadata) : void 0);
|
||||
}
|
||||
async function loadUserConfig(location) {
|
||||
let object = location.resolvedConfigFile ? await (0, import_transform.requireOrImport)(location.resolvedConfigFile) : {};
|
||||
if (object && typeof object === "object" && "default" in object)
|
||||
object = object["default"];
|
||||
return object;
|
||||
}
|
||||
async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
|
||||
if (!(0, import_esmLoaderHost.registerESMLoader)()) {
|
||||
if (location.resolvedConfigFile && (0, import_util.fileIsModule)(location.resolvedConfigFile))
|
||||
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.`);
|
||||
}
|
||||
(0, import_transform.setSingleTSConfig)(overrides?.tsconfig);
|
||||
await (0, import_esmLoaderHost.configureESMLoader)();
|
||||
const userConfig = await loadUserConfig(location);
|
||||
validateConfig(location.resolvedConfigFile || "<default config>", userConfig);
|
||||
const fullConfig = new import_config.FullConfigInternal(location, userConfig, overrides || {}, metadata);
|
||||
fullConfig.defineConfigWasUsed = !!userConfig[kDefineConfigWasUsed];
|
||||
if (ignoreProjectDependencies) {
|
||||
for (const project of fullConfig.projects) {
|
||||
project.deps = [];
|
||||
project.teardown = void 0;
|
||||
}
|
||||
}
|
||||
const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
|
||||
const external = userConfig.build?.external || [];
|
||||
(0, import_transform.setTransformConfig)({ babelPlugins, external });
|
||||
if (!overrides?.tsconfig)
|
||||
(0, import_transform.setSingleTSConfig)(fullConfig?.singleTSConfigPath);
|
||||
await (0, import_esmLoaderHost.configureESMLoaderTransformConfig)();
|
||||
return fullConfig;
|
||||
}
|
||||
function validateConfig(file, config) {
|
||||
if (typeof config !== "object" || !config)
|
||||
throw (0, import_util.errorWithFile)(file, `Configuration file must export a single object`);
|
||||
validateProject(file, config, "config");
|
||||
if ("forbidOnly" in config && config.forbidOnly !== void 0) {
|
||||
if (typeof config.forbidOnly !== "boolean")
|
||||
throw (0, import_util.errorWithFile)(file, `config.forbidOnly must be a boolean`);
|
||||
}
|
||||
if ("globalSetup" in config && config.globalSetup !== void 0) {
|
||||
if (Array.isArray(config.globalSetup)) {
|
||||
config.globalSetup.forEach((item, index) => {
|
||||
if (typeof item !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `config.globalSetup[${index}] must be a string`);
|
||||
});
|
||||
} else if (typeof config.globalSetup !== "string") {
|
||||
throw (0, import_util.errorWithFile)(file, `config.globalSetup must be a string`);
|
||||
}
|
||||
}
|
||||
if ("globalTeardown" in config && config.globalTeardown !== void 0) {
|
||||
if (Array.isArray(config.globalTeardown)) {
|
||||
config.globalTeardown.forEach((item, index) => {
|
||||
if (typeof item !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `config.globalTeardown[${index}] must be a string`);
|
||||
});
|
||||
} else if (typeof config.globalTeardown !== "string") {
|
||||
throw (0, import_util.errorWithFile)(file, `config.globalTeardown must be a string`);
|
||||
}
|
||||
}
|
||||
if ("globalTimeout" in config && config.globalTimeout !== void 0) {
|
||||
if (typeof config.globalTimeout !== "number" || config.globalTimeout < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `config.globalTimeout must be a non-negative number`);
|
||||
}
|
||||
if ("grep" in config && config.grep !== void 0) {
|
||||
if (Array.isArray(config.grep)) {
|
||||
config.grep.forEach((item, index) => {
|
||||
if (!(0, import_utils.isRegExp)(item))
|
||||
throw (0, import_util.errorWithFile)(file, `config.grep[${index}] must be a RegExp`);
|
||||
});
|
||||
} else if (!(0, import_utils.isRegExp)(config.grep)) {
|
||||
throw (0, import_util.errorWithFile)(file, `config.grep must be a RegExp`);
|
||||
}
|
||||
}
|
||||
if ("grepInvert" in config && config.grepInvert !== void 0) {
|
||||
if (Array.isArray(config.grepInvert)) {
|
||||
config.grepInvert.forEach((item, index) => {
|
||||
if (!(0, import_utils.isRegExp)(item))
|
||||
throw (0, import_util.errorWithFile)(file, `config.grepInvert[${index}] must be a RegExp`);
|
||||
});
|
||||
} else if (!(0, import_utils.isRegExp)(config.grepInvert)) {
|
||||
throw (0, import_util.errorWithFile)(file, `config.grepInvert must be a RegExp`);
|
||||
}
|
||||
}
|
||||
if ("maxFailures" in config && config.maxFailures !== void 0) {
|
||||
if (typeof config.maxFailures !== "number" || config.maxFailures < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `config.maxFailures must be a non-negative number`);
|
||||
}
|
||||
if ("preserveOutput" in config && config.preserveOutput !== void 0) {
|
||||
if (typeof config.preserveOutput !== "string" || !["always", "never", "failures-only"].includes(config.preserveOutput))
|
||||
throw (0, import_util.errorWithFile)(file, `config.preserveOutput must be one of "always", "never" or "failures-only"`);
|
||||
}
|
||||
if ("projects" in config && config.projects !== void 0) {
|
||||
if (!Array.isArray(config.projects))
|
||||
throw (0, import_util.errorWithFile)(file, `config.projects must be an array`);
|
||||
config.projects.forEach((project, index) => {
|
||||
validateProject(file, project, `config.projects[${index}]`);
|
||||
});
|
||||
}
|
||||
if ("quiet" in config && config.quiet !== void 0) {
|
||||
if (typeof config.quiet !== "boolean")
|
||||
throw (0, import_util.errorWithFile)(file, `config.quiet must be a boolean`);
|
||||
}
|
||||
if ("reporter" in config && config.reporter !== void 0) {
|
||||
if (Array.isArray(config.reporter)) {
|
||||
config.reporter.forEach((item, index) => {
|
||||
if (!Array.isArray(item) || item.length <= 0 || item.length > 2 || typeof item[0] !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `config.reporter[${index}] must be a tuple [name, optionalArgument]`);
|
||||
});
|
||||
} else if (typeof config.reporter !== "string") {
|
||||
throw (0, import_util.errorWithFile)(file, `config.reporter must be a string`);
|
||||
}
|
||||
}
|
||||
if ("reportSlowTests" in config && config.reportSlowTests !== void 0 && config.reportSlowTests !== null) {
|
||||
if (!config.reportSlowTests || typeof config.reportSlowTests !== "object")
|
||||
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests must be an object`);
|
||||
if (!("max" in config.reportSlowTests) || typeof config.reportSlowTests.max !== "number" || config.reportSlowTests.max < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.max must be a non-negative number`);
|
||||
if (!("threshold" in config.reportSlowTests) || typeof config.reportSlowTests.threshold !== "number" || config.reportSlowTests.threshold < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.threshold must be a non-negative number`);
|
||||
}
|
||||
if ("shard" in config && config.shard !== void 0 && config.shard !== null) {
|
||||
if (!config.shard || typeof config.shard !== "object")
|
||||
throw (0, import_util.errorWithFile)(file, `config.shard must be an object`);
|
||||
if (!("total" in config.shard) || typeof config.shard.total !== "number" || config.shard.total < 1)
|
||||
throw (0, import_util.errorWithFile)(file, `config.shard.total must be a positive number`);
|
||||
if (!("current" in config.shard) || typeof config.shard.current !== "number" || config.shard.current < 1 || config.shard.current > config.shard.total)
|
||||
throw (0, import_util.errorWithFile)(file, `config.shard.current must be a positive number, not greater than config.shard.total`);
|
||||
}
|
||||
if ("updateSnapshots" in config && config.updateSnapshots !== void 0) {
|
||||
if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
|
||||
throw (0, import_util.errorWithFile)(file, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
|
||||
}
|
||||
if ("tsconfig" in config && config.tsconfig !== void 0) {
|
||||
if (typeof config.tsconfig !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `config.tsconfig must be a string`);
|
||||
if (!import_fs.default.existsSync(import_path.default.resolve(file, "..", config.tsconfig)))
|
||||
throw (0, import_util.errorWithFile)(file, `config.tsconfig does not exist`);
|
||||
}
|
||||
}
|
||||
function validateProject(file, project, title) {
|
||||
if (typeof project !== "object" || !project)
|
||||
throw (0, import_util.errorWithFile)(file, `${title} must be an object`);
|
||||
if ("name" in project && project.name !== void 0) {
|
||||
if (typeof project.name !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.name must be a string`);
|
||||
}
|
||||
if ("outputDir" in project && project.outputDir !== void 0) {
|
||||
if (typeof project.outputDir !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.outputDir must be a string`);
|
||||
}
|
||||
if ("repeatEach" in project && project.repeatEach !== void 0) {
|
||||
if (typeof project.repeatEach !== "number" || project.repeatEach < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.repeatEach must be a non-negative number`);
|
||||
}
|
||||
if ("retries" in project && project.retries !== void 0) {
|
||||
if (typeof project.retries !== "number" || project.retries < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.retries must be a non-negative number`);
|
||||
}
|
||||
if ("testDir" in project && project.testDir !== void 0) {
|
||||
if (typeof project.testDir !== "string")
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.testDir must be a string`);
|
||||
}
|
||||
for (const prop of ["testIgnore", "testMatch"]) {
|
||||
if (prop in project && project[prop] !== void 0) {
|
||||
const value = project[prop];
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((item, index) => {
|
||||
if (typeof item !== "string" && !(0, import_utils.isRegExp)(item))
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.${prop}[${index}] must be a string or a RegExp`);
|
||||
});
|
||||
} else if (typeof value !== "string" && !(0, import_utils.isRegExp)(value)) {
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.${prop} must be a string or a RegExp`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("timeout" in project && project.timeout !== void 0) {
|
||||
if (typeof project.timeout !== "number" || project.timeout < 0)
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.timeout must be a non-negative number`);
|
||||
}
|
||||
if ("use" in project && project.use !== void 0) {
|
||||
if (!project.use || typeof project.use !== "object")
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.use must be an object`);
|
||||
}
|
||||
if ("ignoreSnapshots" in project && project.ignoreSnapshots !== void 0) {
|
||||
if (typeof project.ignoreSnapshots !== "boolean")
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.ignoreSnapshots must be a boolean`);
|
||||
}
|
||||
if ("workers" in project && project.workers !== void 0) {
|
||||
if (typeof project.workers === "number" && project.workers <= 0)
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.workers must be a positive number`);
|
||||
else if (typeof project.workers === "string" && !project.workers.endsWith("%"))
|
||||
throw (0, import_util.errorWithFile)(file, `${title}.workers must be a number or percentage`);
|
||||
}
|
||||
}
|
||||
function resolveConfigLocation(configFile) {
|
||||
const configFileOrDirectory = configFile ? import_path.default.resolve(process.cwd(), configFile) : process.cwd();
|
||||
const resolvedConfigFile = resolveConfigFile(configFileOrDirectory);
|
||||
return {
|
||||
resolvedConfigFile,
|
||||
configDir: resolvedConfigFile ? import_path.default.dirname(resolvedConfigFile) : configFileOrDirectory
|
||||
};
|
||||
}
|
||||
function resolveConfigFile(configFileOrDirectory) {
|
||||
const resolveConfig = (configFile) => {
|
||||
if (import_fs.default.existsSync(configFile))
|
||||
return configFile;
|
||||
};
|
||||
const resolveConfigFileFromDirectory = (directory) => {
|
||||
for (const ext of [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"]) {
|
||||
const configFile = resolveConfig(import_path.default.resolve(directory, "playwright.config" + ext));
|
||||
if (configFile)
|
||||
return configFile;
|
||||
}
|
||||
};
|
||||
if (!import_fs.default.existsSync(configFileOrDirectory))
|
||||
throw new Error(`${configFileOrDirectory} does not exist`);
|
||||
if (import_fs.default.statSync(configFileOrDirectory).isDirectory()) {
|
||||
const configFile = resolveConfigFileFromDirectory(configFileOrDirectory);
|
||||
if (configFile)
|
||||
return configFile;
|
||||
return void 0;
|
||||
}
|
||||
return configFileOrDirectory;
|
||||
}
|
||||
async function loadConfigFromFile(configFile, overrides, ignoreDeps) {
|
||||
return await loadConfig(resolveConfigLocation(configFile), overrides, ignoreDeps);
|
||||
}
|
||||
async function loadEmptyConfigForMergeReports() {
|
||||
return await loadConfig({ configDir: process.cwd() });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
defineConfig,
|
||||
deserializeConfig,
|
||||
loadConfig,
|
||||
loadConfigFromFile,
|
||||
loadEmptyConfigForMergeReports,
|
||||
resolveConfigLocation
|
||||
});
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var esmLoaderHost_exports = {};
|
||||
__export(esmLoaderHost_exports, {
|
||||
configureESMLoader: () => configureESMLoader,
|
||||
configureESMLoaderTransformConfig: () => configureESMLoaderTransformConfig,
|
||||
incorporateCompilationCache: () => incorporateCompilationCache,
|
||||
registerESMLoader: () => registerESMLoader,
|
||||
startCollectingFileDeps: () => startCollectingFileDeps,
|
||||
stopCollectingFileDeps: () => stopCollectingFileDeps
|
||||
});
|
||||
module.exports = __toCommonJS(esmLoaderHost_exports);
|
||||
var import_url = __toESM(require("url"));
|
||||
var import_compilationCache = require("../transform/compilationCache");
|
||||
var import_portTransport = require("../transform/portTransport");
|
||||
var import_transform = require("../transform/transform");
|
||||
let loaderChannel;
|
||||
function registerESMLoader() {
|
||||
if (process.env.PW_DISABLE_TS_ESM)
|
||||
return true;
|
||||
if ("Bun" in globalThis)
|
||||
return true;
|
||||
if (loaderChannel)
|
||||
return true;
|
||||
const register = require("node:module").register;
|
||||
if (!register)
|
||||
return false;
|
||||
const { port1, port2 } = new MessageChannel();
|
||||
register(import_url.default.pathToFileURL(require.resolve("../transform/esmLoader")), {
|
||||
data: { port: port2 },
|
||||
transferList: [port2]
|
||||
});
|
||||
loaderChannel = createPortTransport(port1);
|
||||
return true;
|
||||
}
|
||||
function createPortTransport(port) {
|
||||
return new import_portTransport.PortTransport(port, async (method, params) => {
|
||||
if (method === "pushToCompilationCache")
|
||||
(0, import_compilationCache.addToCompilationCache)(params.cache);
|
||||
});
|
||||
}
|
||||
async function startCollectingFileDeps() {
|
||||
if (!loaderChannel)
|
||||
return;
|
||||
await loaderChannel.send("startCollectingFileDeps", {});
|
||||
}
|
||||
async function stopCollectingFileDeps(file) {
|
||||
if (!loaderChannel)
|
||||
return;
|
||||
await loaderChannel.send("stopCollectingFileDeps", { file });
|
||||
}
|
||||
async function incorporateCompilationCache() {
|
||||
if (!loaderChannel)
|
||||
return;
|
||||
const result = await loaderChannel.send("getCompilationCache", {});
|
||||
(0, import_compilationCache.addToCompilationCache)(result.cache);
|
||||
}
|
||||
async function configureESMLoader() {
|
||||
if (!loaderChannel)
|
||||
return;
|
||||
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
|
||||
await loaderChannel.send("addToCompilationCache", { cache: (0, import_compilationCache.serializeCompilationCache)() });
|
||||
}
|
||||
async function configureESMLoaderTransformConfig() {
|
||||
if (!loaderChannel)
|
||||
return;
|
||||
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
|
||||
await loaderChannel.send("setTransformConfig", { config: (0, import_transform.transformConfig)() });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
configureESMLoader,
|
||||
configureESMLoaderTransformConfig,
|
||||
incorporateCompilationCache,
|
||||
registerESMLoader,
|
||||
startCollectingFileDeps,
|
||||
stopCollectingFileDeps
|
||||
});
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var expectBundle_exports = {};
|
||||
__export(expectBundle_exports, {
|
||||
expect: () => expect
|
||||
});
|
||||
module.exports = __toCommonJS(expectBundle_exports);
|
||||
const expect = require("./expectBundleImpl").expect;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
expect
|
||||
});
|
||||
+407
@@ -0,0 +1,407 @@
|
||||
"use strict";var Au=Object.create;var nt=Object.defineProperty;var Cu=Object.getOwnPropertyDescriptor;var vu=Object.getOwnPropertyNames;var Su=Object.getPrototypeOf,Ou=Object.prototype.hasOwnProperty;var Tu=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wu=(e,t)=>{for(var n in t)nt(e,n,{get:t[n],enumerable:!0})},Qn=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of vu(t))!Ou.call(e,s)&&s!==n&&nt(e,s,{get:()=>t[s],enumerable:!(i=Cu(t,s))||i.enumerable});return e};var $u=(e,t,n)=>(n=e!=null?Au(Su(e)):{},Qn(t||!e||!e.__esModule?nt(n,"default",{value:e,enumerable:!0}):n,e)),Lu=e=>Qn(nt({},"__esModule",{value:!0}),e);var Ce=(e,t,n)=>Tu(e,typeof t!="symbol"?t+"":t,n);var je=oe((xc,Jn)=>{(()=>{"use strict";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.getType=n,t.isPrimitive=void 0;function n(s){if(s===void 0)return"undefined";if(s===null)return"null";if(Array.isArray(s))return"array";if(typeof s=="boolean")return"boolean";if(typeof s=="function")return"function";if(typeof s=="number")return"number";if(typeof s=="string")return"string";if(typeof s=="bigint")return"bigint";if(typeof s=="object")return s.constructor===RegExp?"regexp":s.constructor===Map?"map":s.constructor===Set?"set":s.constructor===Date?"date":"object";if(typeof s=="symbol")return"symbol";throw new Error(`value of unknown type: ${s}`)}let i=s=>Object(s)!==s;t.isPrimitive=i})(),Jn.exports=e})()});var Ve=oe((Dc,Zn)=>{(()=>{"use strict";var e={"./src/immutableUtils.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isImmutableList=_,r.isImmutableOrderedKeyed=m,r.isImmutableOrderedSet=A,r.isImmutableRecord=p,r.isImmutableUnorderedKeyed=v,r.isImmutableUnorderedSet=N;let o="@@__IMMUTABLE_KEYED__@@",c="@@__IMMUTABLE_SET__@@",g="@@__IMMUTABLE_LIST__@@",u="@@__IMMUTABLE_ORDERED__@@",b="@@__IMMUTABLE_RECORD__@@";function L(E){return E!=null&&typeof E=="object"&&!Array.isArray(E)}function v(E){return!!(E&&L(E)&&E[o]&&!E[u])}function N(E){return!!(E&&L(E)&&E[c]&&!E[u])}function _(E){return!!(E&&L(E)&&E[g])}function m(E){return!!(E&&L(E)&&E[o]&&E[u])}function A(E){return!!(E&&L(E)&&E[c]&&E[u])}function p(E){return!!(E&&L(E)&&E[b])}}),"./src/index.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0});var c={equals:!0,isA:!0};Object.defineProperty(r,"equals",{enumerable:!0,get:function(){return g.equals}}),Object.defineProperty(r,"isA",{enumerable:!0,get:function(){return g.isA}});var g=o("./src/jasmineUtils.ts"),u=o("./src/utils.ts");Object.keys(u).forEach(function(b){b==="default"||b==="__esModule"||Object.prototype.hasOwnProperty.call(c,b)||b in r&&r[b]===u[b]||Object.defineProperty(r,b,{enumerable:!0,get:function(){return u[b]}})})}),"./src/jasmineUtils.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.equals=void 0,r.isA=v;let o=(_,m,A,p)=>(A=A||[],u(_,m,[],[],A,p));r.equals=o;function c(_){return!!_&&v("Function",_.asymmetricMatch)}function g(_,m){let A=c(_),p=c(m);if(!(A&&p)){if(A)return _.asymmetricMatch(m);if(p)return m.asymmetricMatch(_)}}function u(_,m,A,p,E,a){let h=!0,l=g(_,m);if(l!==void 0)return l;let y={equals:o};for(let P of E){let T=P.call(y,_,m,E);if(T!==void 0)return T}if(_ instanceof Error&&m instanceof Error)return _.message===m.message;if(Object.is(_,m))return!0;if(_===null||m===null)return!1;let $=Object.prototype.toString.call(_);if($!==Object.prototype.toString.call(m))return!1;switch($){case"[object Boolean]":case"[object String]":case"[object Number]":return typeof _!=typeof m||typeof _!="object"&&typeof m!="object"?!1:Object.is(_.valueOf(),m.valueOf());case"[object Date]":return+_==+m;case"[object RegExp]":return _.source===m.source&&_.flags===m.flags;case"[object URL]":return _.href===m.href}if(typeof _!="object"||typeof m!="object")return!1;if(N(_)&&N(m))return _.isEqualNode(m);let C=A.length;for(;C--;){if(A[C]===_)return p[C]===m;if(p[C]===m)return!1}if(A.push(_),p.push(m),a&&$==="[object Array]"&&_.length!==m.length)return!1;let S=b(_,L),R,I=b(m,L);if(!a){for(let P=0;P!==I.length;++P)R=I[P],(c(m[R])||m[R]===void 0)&&!L(_,R)&&S.push(R);for(let P=0;P!==S.length;++P)R=S[P],(c(_[R])||_[R]===void 0)&&!L(m,R)&&I.push(R)}let j=S.length;if(I.length!==j)return!1;for(;j--;)if(R=S[j],a?h=L(m,R)&&u(_[R],m[R],A,p,E,a):h=(L(m,R)||c(_[R])||_[R]===void 0)&&u(_[R],m[R],A,p,E,a),!h)return!1;return A.pop(),p.pop(),h}function b(_,m){let A=[];for(let p in _)m(_,p)&&A.push(p);return[...A,...Object.getOwnPropertySymbols(_).filter(p=>Object.getOwnPropertyDescriptor(_,p).enumerable)]}function L(_,m){return Object.prototype.hasOwnProperty.call(_,m)}function v(_,m){return Object.prototype.toString.apply(m)===`[object ${_}]`}function N(_){return _!==null&&typeof _=="object"&&typeof _.nodeType=="number"&&typeof _.nodeName=="string"&&typeof _.isEqualNode=="function"}}),"./src/utils.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.arrayBufferEquality=void 0,r.eLine truncated
|
||||
`)&&(R=p.spacingOuter+y+R+p.spacingOuter+E),R=`{${R}}`),`${p.spacingInner+E+$.prop.open+C+$.prop.close}=${$.value.open}${R}${$.value.close}`}).join("")};r.printProps=u;let b=(m,A,p,E,a,h)=>m.map(l=>A.spacingOuter+p+(typeof l=="string"?L(l,A):h(l,A,p,E,a))).join("");r.printChildren=b;let L=(m,A)=>{let p=A.colors.content;return p.open+(0,c.default)(m)+p.close};r.printText=L;let v=(m,A)=>{let p=A.colors.comment;return`${p.open}<!--${(0,c.default)(m)}-->${p.close}`};r.printComment=v;let N=(m,A,p,E,a)=>{let h=E.colors.tag;return`${h.open}<${m}${A&&h.close+A+E.spacingOuter+a+h.open}${p?`>${h.close}${p}${E.spacingOuter}${a}${h.open}</${m}`:`${A&&!E.min?"":" "}/`}>${h.close}`};r.printElement=N;let _=(m,A)=>{let p=A.colors.tag;return`${p.open}<${m}${p.close} \u2026${p.open} />${p.close}`};r.printElementAsLeaf=_})},t={};function n(s){var r=t[s];if(r!==void 0)return r.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,n),o.exports}var i={};(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.default=s.DEFAULT_OPTIONS=void 0,s.format=M,s.plugins=void 0;var r=N(or()),o=n("./src/collections.ts"),c=N(n("./src/plugins/AsymmetricMatcher.ts")),g=N(n("./src/plugins/DOMCollection.ts")),u=N(n("./src/plugins/DOMElement.ts")),b=N(n("./src/plugins/Immutable.ts")),L=N(n("./src/plugins/ReactElement.ts")),v=N(n("./src/plugins/ReactTestComponent.ts"));function N(O){return O&&O.__esModule?O:{default:O}}let _=Object.prototype.toString,m=Date.prototype.toISOString,A=Error.prototype.toString,p=RegExp.prototype.toString,E=O=>typeof O.constructor=="function"&&O.constructor.name||"Object",a=O=>typeof window!="undefined"&&O===window,h=/^Symbol\((.*)\)(.*)$/,l=/\n/gi;class y extends Error{constructor(K,Z){super(K),this.stack=Z,this.name=this.constructor.name}}function $(O){return O==="[object Array]"||O==="[object ArrayBuffer]"||O==="[object DataView]"||O==="[object Float32Array]"||O==="[object Float64Array]"||O==="[object Int8Array]"||O==="[object Int16Array]"||O==="[object Int32Array]"||O==="[object Uint8Array]"||O==="[object Uint8ClampedArray]"||O==="[object Uint16Array]"||O==="[object Uint32Array]"}function C(O){return Object.is(O,-0)?"-0":String(O)}function S(O){return`${O}n`}function R(O,K){return K?`[Function ${O.name||"anonymous"}]`:"[Function]"}function I(O){return String(O).replace(h,"Symbol($1)")}function j(O){return`[${A.call(O)}]`}function P(O,K,Z,H){if(O===!0||O===!1)return`${O}`;if(O===void 0)return"undefined";if(O===null)return"null";let B=typeof O;if(B==="number")return C(O);if(B==="bigint")return S(O);if(B==="string")return H?`"${O.replaceAll(/"|\\/g,"\\$&")}"`:`"${O}"`;if(B==="function")return R(O,K);if(B==="symbol")return I(O);let D=_.call(O);return D==="[object Promise]"?"Promise {}":D==="[object WeakMap]"?"WeakMap {}":D==="[object WeakSet]"?"WeakSet {}":D==="[object Function]"||D==="[object GeneratorFunction]"?R(O,K):D==="[object Symbol]"?I(O):D==="[object Date]"?Number.isNaN(+O)?"Date { NaN }":m.call(O):D==="[object Error]"?j(O):D==="[object RegExp]"?Z?p.call(O).replaceAll(/[$()*+.?[\\\]^{|}]/g,"\\$&"):p.call(O):O instanceof Error?j(O):null}function T(O,K,Z,H,B,D){if(B.includes(O))return"[Circular]";B=[...B],B.push(O);let U=++H>K.maxDepth,V=K.min;if(K.callToJSON&&!U&&O.toJSON&&typeof O.toJSON=="function"&&!D)return x(O.toJSON(),K,Z,H,B,!0);let te=_.call(O);return te==="[object Arguments]"?U?"[Arguments]":`${V?"":"Arguments "}[${(0,o.printListItems)(O,K,Z,H,B,x)}]`:$(te)?U?`[${O.constructor.name}]`:`${V||!K.printBasicPrototype&&O.constructor.name==="Array"?"":`${O.constructor.name} `}[${(0,o.printListItems)(O,K,Z,H,B,x)}]`:te==="[object Map]"?U?"[Map]":`Map {${(0,o.printIteratorEntries)(O.entries(),K,Z,H,B,x," => ")}}`:te==="[object Set]"?U?"[Set]":`Set {${(0,o.printIteratorValues)(O.values(),K,Z,H,B,x)}}`:U||a(O)?`[${E(O)}]`:`${V||!K.printBasicPrototype&&E(O)==="Object"?"":`${E(O)} `}{${(0,o.printObjectProperties)(O,K,Z,H,B,x)}}`}function f(O){return O.serialize!=null}function d(O,K,Z,H,B,D){let U;try{U=f(O)?O.serialize(K,Z,H,B,D,x):O.print(K,V=>x(V,Z,H,B,D),V=>{let te=H+Z.indent;return te+V.replaceAll(l,`
|
||||
${te}`)},{edgeSpacing:Z.spacingOuter,min:Z.min,spacing:Z.spacingInner},Z.colors)}catch(V){throw new y(V.message,V.stack)}if(typeof U!="string")throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof U}".`);return U}function w(O,K){for(let Z of O)try{if(Z.test(K))return Z}catch(H){throw new y(H.message,H.stack)}return null}function x(O,K,Z,H,B,D){let U=w(K.plugins,O);if(U!==null)return d(U,O,K,Z,H,B);let V=P(O,K.printFunctionName,K.escapeRegex,K.escapeString);return V!==null?V:T(O,K,Z,H,B,D)}let k={comment:"gray",content:"reset",prop:"yellow",tag:"cyan",value:"green"},G=Object.keys(k),W=O=>O,se=s.DEFAULT_OPTIONS=W({callToJSON:!0,compareKeys:void 0,escapeRegex:!1,escapeString:!0,highlight:!1,indent:2,maxDepth:Number.POSITIVE_INFINITY,maxWidth:Number.POSITIVE_INFINITY,min:!1,plugins:[],printBasicPrototype:!0,printFunctionName:!0,theme:k});function ue(O){for(let K of Object.keys(O))if(!Object.prototype.hasOwnProperty.call(se,K))throw new Error(`pretty-format: Unknown option "${K}".`);if(O.min&&O.indent!==void 0&&O.indent!==0)throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');if(O.theme!==void 0){if(O.theme===null)throw new Error('pretty-format: Option "theme" must not be null.');if(typeof O.theme!="object")throw new TypeError(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof O.theme}".`)}}let ee=O=>G.reduce((K,Z)=>{let H=O.theme&&O.theme[Z]!==void 0?O.theme[Z]:k[Z],B=H&&r.default[H];if(B&&typeof B.close=="string"&&typeof B.open=="string")K[Z]=B;else throw new Error(`pretty-format: Option "theme" has a key "${Z}" whose value "${H}" is undefined in ansi-styles.`);return K},Object.create(null)),q=()=>G.reduce((O,K)=>(O[K]={close:"",open:""},O),Object.create(null)),z=O=>{var K;return(K=O==null?void 0:O.printFunctionName)!=null?K:se.printFunctionName},ie=O=>{var K;return(K=O==null?void 0:O.escapeRegex)!=null?K:se.escapeRegex},X=O=>{var K;return(K=O==null?void 0:O.escapeString)!=null?K:se.escapeString},Y=O=>{var K,Z,H,B,D,U,V;return{callToJSON:(K=O==null?void 0:O.callToJSON)!=null?K:se.callToJSON,colors:O!=null&&O.highlight?ee(O):q(),compareKeys:typeof(O==null?void 0:O.compareKeys)=="function"||(O==null?void 0:O.compareKeys)===null?O.compareKeys:se.compareKeys,escapeRegex:ie(O),escapeString:X(O),indent:O!=null&&O.min?"":J((Z=O==null?void 0:O.indent)!=null?Z:se.indent),maxDepth:(H=O==null?void 0:O.maxDepth)!=null?H:se.maxDepth,maxWidth:(B=O==null?void 0:O.maxWidth)!=null?B:se.maxWidth,min:(D=O==null?void 0:O.min)!=null?D:se.min,plugins:(U=O==null?void 0:O.plugins)!=null?U:se.plugins,printBasicPrototype:(V=O==null?void 0:O.printBasicPrototype)!=null?V:!0,printFunctionName:z(O),spacingInner:O!=null&&O.min?" ":`
|
||||
`,spacingOuter:O!=null&&O.min?"":`
|
||||
`}};function J(O){return Array.from({length:O+1}).join(" ")}function M(O,K){if(K&&(ue(K),K.plugins)){let H=w(K.plugins,O);if(H!==null)return d(H,O,Y(K),"",0,[])}let Z=P(O,z(K),ie(K),X(K));return Z!==null?Z:T(O,Y(K),"",0,[])}let F=s.plugins={AsymmetricMatcher:c.default,DOMCollection:g.default,DOMElement:u.default,Immutable:b.default,ReactElement:L.default,ReactTestComponent:v.default};var Q=s.default=M})(),ar.exports=i})()});var lr=oe((Uc,cr)=>{"use strict";cr.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var nn=oe((qc,pr)=>{var st=lr(),fr={};for(let e of Object.keys(st))fr[st[e]]=e;var ae={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};pr.exports=ae;for(let e of Object.keys(ae)){if(!("channels"in ae[e]))throw new Error("missing channels property: "+e);if(!("labels"in ae[e]))throw new Error("missing channel labels property: "+e);if(ae[e].labels.length!==ae[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:n}=ae[e];delete ae[e].channels,delete ae[e].labels,Object.defineProperty(ae[e],"channels",{value:t}),Object.defineProperty(ae[e],"labels",{value:n})}ae.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255,s=Math.
Line truncated
|
||||
`:`
|
||||
`)+n,s=i+1,i=e.indexOf(`
|
||||
`,s)}while(i!==-1);return r+=e.substr(s),r};wr.exports={stringReplaceAll:Ku,stringEncaseCRLFWithFirstIndex:Vu}});var Pr=oe((Xc,Mr)=>{"use strict";var Yu=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Lr=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,zu=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Xu=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Qu=new Map([["n",`
|
||||
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ir(e){let t=e[0]==="u",n=e[1]==="{";return t&&!n&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(parseInt(e.slice(2,-1),16)):Qu.get(e)||e}function Ju(e,t){let n=[],i=t.trim().split(/\s*,\s*/g),s;for(let r of i){let o=Number(r);if(!Number.isNaN(o))n.push(o);else if(s=r.match(zu))n.push(s[2].replace(Xu,(c,g,u)=>g?Ir(g):u));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${e}')`)}return n}function Zu(e){Lr.lastIndex=0;let t=[],n;for(;(n=Lr.exec(e))!==null;){let i=n[1];if(n[2]){let s=Ju(i,n[2]);t.push([i].concat(s))}else t.push([i])}return t}function Nr(e,t){let n={};for(let s of t)for(let r of s.styles)n[r[0]]=s.inverse?null:r.slice(1);let i=e;for(let[s,r]of Object.entries(n))if(Array.isArray(r)){if(!(s in i))throw new Error(`Unknown Chalk style: ${s}`);i=r.length>0?i[s](...r):i[s]}return i}Mr.exports=(e,t)=>{let n=[],i=[],s=[];if(t.replace(Yu,(r,o,c,g,u,b)=>{if(o)s.push(Ir(o));else if(g){let L=s.join("");s=[],i.push(n.length===0?L:Nr(e,n)(L)),n.push({inverse:c,styles:Zu(g)})}else if(u){if(n.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(Nr(e,n)(s.join(""))),s=[],n.pop()}else s.push(b)}),i.push(s.join("")),n.length>0){let r=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return i.join("")}});var Ue=oe((Qc,Br)=>{"use strict";var it=Ar(),{stdout:cn,stderr:ln}=Tr(),{stringReplaceAll:eo,stringEncaseCRLFWithFirstIndex:to}=$r(),{isArray:It}=Array,Dr=["ansi","ansi","ansi256","ansi16m"],Qe=Object.create(null),no=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=cn?cn.level:0;e.level=t.level===void 0?n:t.level},fn=class{constructor(t){return Hr(t)}},Hr=e=>{let t={};return no(t,e),t.template=(...n)=>kr(t.template,...n),Object.setPrototypeOf(t,Mt.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=fn,t.template};function Mt(e){return Hr(e)}for(let[e,t]of Object.entries(it))Qe[e]={get(){let n=Pt(this,pn(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:n}),n}};Qe.visible={get(){let e=Pt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};var jr=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let e of jr)Qe[e]={get(){let{level:t}=this;return function(...n){let i=pn(it.color[Dr[t]][e](...n),it.color.close,this._styler);return Pt(this,i,this._isEmpty)}}};for(let e of jr){let t="bg"+e[0].toUpperCase()+e.slice(1);Qe[t]={get(){let{level:n}=this;return function(...i){let s=pn(it.bgColor[Dr[n]][e](...i),it.bgColor.close,this._styler);return Pt(this,s,this._isEmpty)}}}}var ro=Object.defineProperties(()=>{},{...Qe,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),pn=(e,t,n)=>{let i,s;return n===void 0?(i=e,s=t):(i=n.openAll+e,s=t+n.closeAll),{open:e,close:t,openAll:i,closeAll:s,parent:n}},Pt=(e,t,n)=>{let i=(...s)=>It(s[0])&&It(s[0].raw)?xr(i,kr(i,...s)):xr(i,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(i,ro),i._generator=e,i._styler=t,i._isEmpty=n,i},xr=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let n=e._styler;if(n===void 0)return t;let{openAll:i,closeAll:s}=n;if(t.indexOf("\x1B")!==-1)for(;n!==void 0;)t=eo(t,n.close,n.open),n=n.parent;let r=t.indexOf(`
|
||||
`);return r!==-1&&(t=to(t,s,i,r)),i+t+s},an,kr=(e,...t)=>{let[n]=t;if(!It(n)||!It(n.raw))return t.join(" ");let i=t.slice(1),s=[n.raw[0]];for(let r=1;r<n.length;r++)s.push(String(i[r-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[r]));return an===void 0&&(an=Pr()),an(e,s.join(""))};Object.defineProperties(Mt.prototype,Qe);var xt=Mt();xt.supportsColor=cn;xt.stderr=Mt({level:ln?ln.level:0});xt.stderr.supportsColor=ln;Br.exports=xt});var dn=oe((Jc,Fr)=>{(()=>{"use strict";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.default=_;let n="@jest/diff-sequences",i=0,s=(m,A,p,E,a)=>{let h=0;for(;m<A&&p<E&&a(m,p);)m+=1,p+=1,h+=1;return h},r=(m,A,p,E,a)=>{let h=0;for(;m<=A&&p<=E&&a(A,E);)A-=1,E-=1,h+=1;return h},o=(m,A,p,E,a,h,l)=>{let y=0,$=-m,C=h[y],S=C;h[y]+=s(C+1,A,E+C-$+1,p,a);let R=Math.min(m,l);for(y+=1,$+=2;y<=R;y+=1,$+=2){if(y!==m&&S<h[y])C=h[y];else if(C=S+1,A<=C)return y-1;S=h[y],h[y]=C+s(C+1,A,E+C-$+1,p,a)}return l},c=(m,A,p,E,a,h,l)=>{let y=0,$=m,C=h[y],S=C;h[y]-=r(A,C-1,p,E+C-$-1,a);let R=Math.min(m,l);for(y+=1,$-=2;y<=R;y+=1,$-=2){if(y!==m&&h[y]<S)C=h[y];else if(C=S-1,C<A)return y-1;S=h[y],h[y]=C-r(A,C-1,p,E+C-$-1,a)}return l},g=(m,A,p,E,a,h,l,y,$,C,S)=>{let R=E-A,I=p-A,P=a-E-I,T=-P-(m-1),f=-P+(m-1),d=i,w=Math.min(m,y);for(let x=0,k=-m;x<=w;x+=1,k+=2){let G=x===0||x!==m&&d<l[x],W=G?l[x]:d,se=G?W:W+1,ue=R+se-k,ee=s(se+1,p,ue+1,a,h),q=se+ee;if(d=l[x],l[x]=q,T<=k&&k<=f){let z=(m-1-(k+P))/2;if(z<=C&&$[z]-1<=q){let ie=R+W-(G?k+1:k-1),X=r(A,W,E,ie,h),Y=W-X,J=ie-X,M=Y+1,F=J+1;S.nChangePreceding=m-1,m-1===M+F-A-E?(S.aEndPreceding=A,S.bEndPreceding=E):(S.aEndPreceding=M,S.bEndPreceding=F),S.nCommonPreceding=X,X!==0&&(S.aCommonPreceding=M,S.bCommonPreceding=F),S.nCommonFollowing=ee,ee!==0&&(S.aCommonFollowing=se+1,S.bCommonFollowing=ue+1);let Q=q+1,O=ue+ee+1;return S.nChangeFollowing=m-1,m-1===p+a-Q-O?(S.aStartFollowing=p,S.bStartFollowing=a):(S.aStartFollowing=Q,S.bStartFollowing=O),!0}}}return!1},u=(m,A,p,E,a,h,l,y,$,C,S)=>{let R=a-p,I=p-A,P=a-E-I,T=P-m,f=P+m,d=i,w=Math.min(m,C);for(let x=0,k=m;x<=w;x+=1,k-=2){let G=x===0||x!==m&&$[x]<d,W=G?$[x]:d,se=G?W:W-1,ue=R+se-k,ee=r(A,se-1,E,ue-1,h),q=se-ee;if(d=$[x],$[x]=q,T<=k&&k<=f){let z=(m+(k-P))/2;if(z<=y&&q-1<=l[z]){let ie=ue-ee;if(S.nChangePreceding=m,m===q+ie-A-E?(S.aEndPreceding=A,S.bEndPreceding=E):(S.aEndPreceding=q,S.bEndPreceding=ie),S.nCommonPreceding=ee,ee!==0&&(S.aCommonPreceding=q,S.bCommonPreceding=ie),S.nChangeFollowing=m-1,m===1)S.nCommonFollowing=0,S.aStartFollowing=p,S.bStartFollowing=a;else{let X=R+W-(G?k-1:k+1),Y=s(W,p,X,a,h);S.nCommonFollowing=Y,Y!==0&&(S.aCommonFollowing=W,S.bCommonFollowing=X);let J=W+Y,M=X+Y;m-1===p+a-J-M?(S.aStartFollowing=p,S.bStartFollowing=a):(S.aStartFollowing=J,S.bStartFollowing=M)}return!0}}}return!1},b=(m,A,p,E,a,h,l,y,$)=>{let C=E-A,S=a-p,R=p-A,I=a-E,j=I-R,P=R,T=R;if(l[0]=A-1,y[0]=p,j%2===0){let f=(m||j)/2,d=(R+I)/2;for(let w=1;w<=d;w+=1)if(P=o(w,p,a,C,h,l,P),w<f)T=c(w,A,E,S,h,y,T);else if(u(w,A,p,E,a,h,l,P,y,T,$))return}else{let f=((m||j)+1)/2,d=(R+I+1)/2,w=1;for(P=o(w,p,a,C,h,l,P),w+=1;w<=d;w+=1)if(T=c(w-1,A,E,S,h,y,T),w<f)P=o(w,p,a,C,h,l,P);else if(g(w,A,p,E,a,h,l,P,y,T,$))return}throw new Error(`${n}: no overlap aStart=${A} aEnd=${p} bStart=${E} bEnd=${a}`)},L=(m,A,p,E,a,h,l,y,$,C)=>{if(a-E<p-A){if(h=!h,h&&l.length===1){let{foundSubsequence:q,isCommon:z}=l[0];l[1]={foundSubsequence:(ie,X,Y)=>{q(ie,Y,X)},isCommon:(ie,X)=>z(X,ie)}}let ue=A,ee=p;A=E,p=a,E=ue,a=ee}let{foundSubsequence:S,isCommon:R}=l[h?1:0];b(m,A,p,E,a,R,y,$,C);let{nChangePreceding:I,aEndPreceding:j,bEndPreceding:P,nCommonPreceding:T,aCommonPreceding:f,bCommonPreceding:d,nCommonFollowing:w,aCommonFollowing:x,bCommonFollowing:k,nChangeFollowing:G,aStartFollowing:W,bStartFollowing:se}=C;A<j&&E<P&&L(I,A,j,E,P,h,l,y,$,C),T!==0&&S(T,f,d),w!==0&&S(w,x,k),W<p&&se<a&&L(G,W,p,se,a,h,l,y,$,C)},v=(m,A)=>{if(typeof A!="number")throw new TypeError(`${n}: ${m} typeof ${typeof A} is not a number`);if(!Number.isSafeInteger(A))throw new RangeError(`${n}: ${m} value ${A} is not a safe integer`);if(A<0)throw new RangeError(`${n}: ${m} value ${A} is a negative integer`)},N=(m,A)=>{let p=typeof A;if(p!=="function")throw new TypeError(`${n}: ${m} typeof ${p} is not a function`)};function _(m,A,p,E){v("aLength",m),v("bLength",A),N("isCommon",p),N("foundSubsequence",E);let a=s(0,m,0,A,p);if(a!==0&&E(a,0,0),m!==a||A!==a){let h=a,l=a,y=r(h,m-1,l,A-1,p),$=m-y,C=A-y,S=a+y;m!==S&&A!==S&&L(0,h,$,l,C,!1,[{foundSubsequence:E,isCommon:p}],[i],[i],{aCommonFollowing:i,aCommonPreceding:i,aEndPreceding:i,aStartFollowing:i,bCommonFollowing:i,bCommonPreceding:i,bEndPreceding:i,bStartFollowing:i,nChangeFollowing:i,nChangePreceding:i,nCommonFollowing:i,nCommonPreceding:i}),y!==0&&E(y,$,C)}}})(),Fr.exports=e})()});var qr=oe((Zc,Ur)=>{(()=>{"use strict";var e={"./src/cleanupSemantic.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.cleanupSemantic=r.Diff=r.DIFF_INSERT=r.DIFF_EQUAL=r.DIFF_DELETE=void 0;var o=r.DIFF_DELETE=-1,c=r.DIFF_INSERT=1,g=r.DIFF_EQUAL
Line truncated
|
||||
${C(d)}
|
||||
|
||||
`},A=(h,l)=>m(l,_(h))+(l.expand?(0,b.joinAlignedDiffsExpand)(h,l):(0,b.joinAlignedDiffsNoExpand)(h,l));r.printDiffLines=A;let p=(h,l,y)=>A(a(N(h)?[]:h.map(u.escapeControlCharacters),N(l)?[]:l.map(u.escapeControlCharacters)),(0,L.normalizeDiffOptions)(y));r.diffLinesUnified=p;let E=(h,l,y,$,C)=>{if(N(h)&&N(y)&&(h=[],y=[]),N(l)&&N($)&&(l=[],$=[]),h.length!==y.length||l.length!==$.length)return p(h,l,C);let S=a(y,$),R=0,I=0;for(let j of S)switch(j[0]){case g.DIFF_DELETE:j[1]=h[R],R+=1;break;case g.DIFF_INSERT:j[1]=l[I],I+=1;break;default:j[1]=l[I],R+=1,I+=1}return A(S,(0,L.normalizeDiffOptions)(C))};r.diffLinesUnified2=E;let a=(h,l)=>{let y=h.length,$=l.length,C=(P,T)=>h[P]===l[T],S=[],R=0,I=0,j=(P,T,f)=>{for(;R!==T;R+=1)S.push(new g.Diff(g.DIFF_DELETE,h[R]));for(;I!==f;I+=1)S.push(new g.Diff(g.DIFF_INSERT,l[I]));for(;P!==0;P-=1,R+=1,I+=1)S.push(new g.Diff(g.DIFF_EQUAL,l[I]))};for((0,c.default)(y,$,C,j);R!==y;R+=1)S.push(new g.Diff(g.DIFF_DELETE,h[R]));for(;I!==$;I+=1)S.push(new g.Diff(g.DIFF_INSERT,l[I]));return S};r.diffLinesRaw=a}),"./src/diffStrings.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=u(dn()),g=o("./src/cleanupSemantic.ts");function u(v){return v&&v.__esModule?v:{default:v}}let b=(v,N)=>{let _=(a,h)=>v[a]===N[h],m=0,A=0,p=[],E=(a,h,l)=>{m!==h&&p.push(new g.Diff(g.DIFF_DELETE,v.slice(m,h))),A!==l&&p.push(new g.Diff(g.DIFF_INSERT,N.slice(A,l))),m=h+a,A=l+a,p.push(new g.Diff(g.DIFF_EQUAL,N.slice(l,A)))};return(0,c.default)(v.length,N.length,_,E),m!==v.length&&p.push(new g.Diff(g.DIFF_DELETE,v.slice(m))),A!==N.length&&p.push(new g.Diff(g.DIFF_INSERT,N.slice(A))),p};var L=r.default=b}),"./src/escapeControlCharacters.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.escapeControlCharacters=void 0;let o=c=>c.replaceAll(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g,g=>{switch(g){case"\b":return"\\b";case"\f":return"\\f";case"\v":return"\\v";default:return`\\x${g.codePointAt(0).toString(16).padStart(2,"0")}`}});r.escapeControlCharacters=o}),"./src/getAlignedDiffs.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=o("./src/cleanupSemantic.ts");let g=(N,_,m)=>_.reduce((A,p)=>A+(p[0]===c.DIFF_EQUAL?p[1]:p[0]===N&&p[1].length>0?m(p[1]):""),"");class u{constructor(_,m){Ce(this,"op");Ce(this,"line");Ce(this,"lines");Ce(this,"changeColor");this.op=_,this.line=[],this.lines=[],this.changeColor=m}pushSubstring(_){this.pushDiff(new c.Diff(this.op,_))}pushLine(){this.lines.push(this.line.length===1?this.line[0][0]===this.op?this.line[0]:new c.Diff(this.op,this.line[0][1]):new c.Diff(this.op,g(this.op,this.line,this.changeColor))),this.line.length=0}isLineEmpty(){return this.line.length===0}pushDiff(_){this.line.push(_)}align(_){let m=_[1];if(m.includes(`
|
||||
`)){let A=m.split(`
|
||||
`),p=A.length-1;for(let[E,a]of A.entries())E<p?(this.pushSubstring(a),this.pushLine()):a.length>0&&this.pushSubstring(a)}else this.pushDiff(_)}moveLinesTo(_){this.isLineEmpty()||this.pushLine(),_.push(...this.lines),this.lines.length=0}}class b{constructor(_,m){Ce(this,"deleteBuffer");Ce(this,"insertBuffer");Ce(this,"lines");this.deleteBuffer=_,this.insertBuffer=m,this.lines=[]}pushDiffCommonLine(_){this.lines.push(_)}pushDiffChangeLines(_){let m=_[1].length===0;(!m||this.deleteBuffer.isLineEmpty())&&this.deleteBuffer.pushDiff(_),(!m||this.insertBuffer.isLineEmpty())&&this.insertBuffer.pushDiff(_)}flushChangeLines(){this.deleteBuffer.moveLinesTo(this.lines),this.insertBuffer.moveLinesTo(this.lines)}align(_){let m=_[0],A=_[1];if(A.includes(`
|
||||
`)){let p=A.split(`
|
||||
`),E=p.length-1;for(let[a,h]of p.entries())if(a===0){let l=new c.Diff(m,h);this.deleteBuffer.isLineEmpty()&&this.insertBuffer.isLineEmpty()?(this.flushChangeLines(),this.pushDiffCommonLine(l)):(this.pushDiffChangeLines(l),this.flushChangeLines())}else a<E?this.pushDiffCommonLine(new c.Diff(m,h)):h.length>0&&this.pushDiffChangeLines(new c.Diff(m,h))}else this.pushDiffChangeLines(_)}getLines(){return this.flushChangeLines(),this.lines}}let L=(N,_)=>{let m=new u(c.DIFF_DELETE,_),A=new u(c.DIFF_INSERT,_),p=new b(m,A);for(let E of N)switch(E[0]){case c.DIFF_DELETE:m.align(E);break;case c.DIFF_INSERT:A.align(E);break;default:p.align(E)}return p.getLines()};var v=r.default=L}),"./src/joinAlignedDiffs.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.joinAlignedDiffsNoExpand=r.joinAlignedDiffsExpand=void 0;var c=o("./src/cleanupSemantic.ts");let g=(A,p)=>A.replace(/\s+$/,E=>p(E)),u=(A,p,E,a,h,l)=>A.length===0?a===" "?p&&l.length>0?E(`${a} ${l}`):"":E(a):E(`${a} ${g(A,h)}`),b=(A,p,{aColor:E,aIndicator:a,changeLineTrailingSpaceColor:h,emptyFirstOrLastLinePlaceholder:l})=>u(A,p,E,a,h,l),L=(A,p,{bColor:E,bIndicator:a,changeLineTrailingSpaceColor:h,emptyFirstOrLastLinePlaceholder:l})=>u(A,p,E,a,h,l),v=(A,p,{commonColor:E,commonIndicator:a,commonLineTrailingSpaceColor:h,emptyFirstOrLastLinePlaceholder:l})=>u(A,p,E,a,h,l),N=(A,p,E,a,{patchColor:h})=>h(`@@ -${A+1},${p-A} +${E+1},${a-E} @@`),_=(A,p)=>{let E=A.length,a=p.contextLines,h=a+a,l=E,y=!1,$=0,C=0;for(;C!==E;){let G=C;for(;C!==E&&A[C][0]===c.DIFF_EQUAL;)C+=1;if(G!==C)if(G===0)C>a&&(l-=C-a,y=!0);else if(C===E){let W=C-G;W>a&&(l-=W-a,y=!0)}else{let W=C-G;W>h&&(l-=W-h,$+=1)}for(;C!==E&&A[C][0]!==c.DIFF_EQUAL;)C+=1}let S=$!==0||y;$!==0?l+=$+1:y&&(l+=1);let R=l-1,I=[],j=0;S&&I.push("");let P=0,T=0,f=0,d=0,w=G=>{let W=I.length;I.push(v(G,W===0||W===R,p)),f+=1,d+=1},x=G=>{let W=I.length;I.push(b(G,W===0||W===R,p)),f+=1},k=G=>{let W=I.length;I.push(L(G,W===0||W===R,p)),d+=1};for(C=0;C!==E;){let G=C;for(;C!==E&&A[C][0]===c.DIFF_EQUAL;)C+=1;if(G!==C)if(G===0){C>a&&(G=C-a,P=G,T=G,f=P,d=T);for(let W=G;W!==C;W+=1)w(A[W][1])}else if(C===E){let W=C-G>a?G+a:C;for(let se=G;se!==W;se+=1)w(A[se][1])}else{let W=C-G;if(W>h){let se=G+a;for(let ee=G;ee!==se;ee+=1)w(A[ee][1]);I[j]=N(P,f,T,d,p),j=I.length,I.push("");let ue=W-h;P=f+ue,T=d+ue,f=P,d=T;for(let ee=C-a;ee!==C;ee+=1)w(A[ee][1])}else for(let se=G;se!==C;se+=1)w(A[se][1])}for(;C!==E&&A[C][0]===c.DIFF_DELETE;)x(A[C][1]),C+=1;for(;C!==E&&A[C][0]===c.DIFF_INSERT;)k(A[C][1]),C+=1}return S&&(I[j]=N(P,f,T,d,p)),I.join(`
|
||||
`)};r.joinAlignedDiffsNoExpand=_;let m=(A,p)=>A.map((E,a,h)=>{let l=E[1],y=a===0||a===h.length-1;switch(E[0]){case c.DIFF_DELETE:return b(l,y,p);case c.DIFF_INSERT:return L(l,y,p);default:return v(l,y,p)}}).join(`
|
||||
`);r.joinAlignedDiffsExpand=m}),"./src/normalizeDiffOptions.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.normalizeDiffOptions=r.noColor=void 0;var o=c(Ue());function c(_){return _&&_.__esModule?_:{default:_}}let g=_=>_;r.noColor=g;let u=5,b={aAnnotation:"Expected",aColor:o.default.green,aIndicator:"-",bAnnotation:"Received",bColor:o.default.red,bIndicator:"+",changeColor:o.default.inverse,changeLineTrailingSpaceColor:g,commonColor:o.default.dim,commonIndicator:" ",commonLineTrailingSpaceColor:g,compareKeys:void 0,contextLines:u,emptyFirstOrLastLinePlaceholder:"",expand:!0,includeChangeCounts:!1,omitAnnotationLines:!1,patchColor:o.default.yellow},L=_=>_&&typeof _=="function"?_:b.compareKeys,v=_=>typeof _=="number"&&Number.isSafeInteger(_)&&_>=0?_:u,N=(_={})=>({...b,..._,compareKeys:L(_.compareKeys),contextLines:v(_.contextLines)});r.normalizeDiffOptions=N}),"./src/printDiffs.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.diffStringsUnified=r.diffStringsRaw=void 0;var c=o("./src/cleanupSemantic.ts"),g=o("./src/diffLines.ts"),u=v(o("./src/diffStrings.ts")),b=v(o("./src/getAlignedDiffs.ts")),L=o("./src/normalizeDiffOptions.ts");function v(A){return A&&A.__esModule?A:{default:A}}let N=(A,p)=>{if(p){let E=A.length-1;return A.some((a,h)=>a[0]===c.DIFF_EQUAL&&(h!==E||a[1]!==`
|
||||
`))}return A.some(E=>E[0]===c.DIFF_EQUAL)},_=(A,p,E)=>{if(A!==p&&A.length>0&&p.length>0){let a=A.includes(`
|
||||
`)||p.includes(`
|
||||
`),h=m(a?`${A}
|
||||
`:A,a?`${p}
|
||||
`:p,!0);if(N(h,a)){let l=(0,L.normalizeDiffOptions)(E),y=(0,b.default)(h,l.changeColor);return(0,g.printDiffLines)(y,l)}}return(0,g.diffLinesUnified)(A.split(`
|
||||
`),p.split(`
|
||||
`),E)};r.diffStringsUnified=_;let m=(A,p,E)=>{let a=(0,u.default)(A,p);return E&&(0,c.cleanupSemantic)(a),a};r.diffStringsRaw=m})},t={};function n(s){var r=t[s];if(r!==void 0)return r.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,n),o.exports}var i={};(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"DIFF_DELETE",{enumerable:!0,get:function(){return g.DIFF_DELETE}}),Object.defineProperty(s,"DIFF_EQUAL",{enumerable:!0,get:function(){return g.DIFF_EQUAL}}),Object.defineProperty(s,"DIFF_INSERT",{enumerable:!0,get:function(){return g.DIFF_INSERT}}),Object.defineProperty(s,"Diff",{enumerable:!0,get:function(){return g.Diff}}),s.diff=R,Object.defineProperty(s,"diffLinesRaw",{enumerable:!0,get:function(){return b.diffLinesRaw}}),Object.defineProperty(s,"diffLinesUnified",{enumerable:!0,get:function(){return b.diffLinesUnified}}),Object.defineProperty(s,"diffLinesUnified2",{enumerable:!0,get:function(){return b.diffLinesUnified2}}),Object.defineProperty(s,"diffStringsRaw",{enumerable:!0,get:function(){return N.diffStringsRaw}}),Object.defineProperty(s,"diffStringsUnified",{enumerable:!0,get:function(){return N.diffStringsUnified}});var r=_(Ue()),o=je(),c=rt(),g=n("./src/cleanupSemantic.ts"),u=n("./src/constants.ts"),b=n("./src/diffLines.ts"),L=n("./src/escapeControlCharacters.ts"),v=n("./src/normalizeDiffOptions.ts"),N=n("./src/printDiffs.ts");function _(w){return w&&w.__esModule?w:{default:w}}var m=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol;let A=(w,x)=>{let{commonColor:k}=(0,v.normalizeDiffOptions)(x);return k(w)},{AsymmetricMatcher:p,DOMCollection:E,DOMElement:a,Immutable:h,ReactElement:l,ReactTestComponent:y}=c.plugins,$=[y,l,a,E,h,p],C={plugins:$},S={callToJSON:!1,maxDepth:10,plugins:$};function R(w,x,k){if(Object.is(w,x))return A(u.NO_DIFF_MESSAGE,k);let G=(0,o.getType)(w),W=G,se=!1;if(G==="object"&&typeof w.asymmetricMatch=="function"){if(w.$$typeof!==m.for("jest.asymmetricMatcher")||typeof w.getExpectedType!="function")return null;W=w.getExpectedType(),se=W==="string"}if(W!==(0,o.getType)(x))return` Comparing two different types of values. Expected ${r.default.green(W)} but received ${r.default.red((0,o.getType)(x))}.`;if(se)return null;switch(G){case"string":return(0,b.diffLinesUnified)((0,L.escapeControlCharacters)(w).split(`
|
||||
`),(0,L.escapeControlCharacters)(x).split(`
|
||||
`),k);case"boolean":case"number":return I(w,x,k);case"map":return T(j(w),j(x),k);case"set":return T(P(w),P(x),k);default:return T(w,x,k)}}function I(w,x,k){let G=(0,c.format)(w,C),W=(0,c.format)(x,C);return G===W?A(u.NO_DIFF_MESSAGE,k):(0,b.diffLinesUnified)(G.split(`
|
||||
`),W.split(`
|
||||
`),k)}function j(w){return new Map([...w].sort())}function P(w){return new Set([...w].sort())}function T(w,x,k){let G,W=!1;try{let ue=f(C,k);G=d(w,x,ue,k)}catch{W=!0}let se=A(u.NO_DIFF_MESSAGE,k);if(G===void 0||G===se){let ue=f(S,k);G=d(w,x,ue,k),G!==se&&!W&&(G=`${A(u.SIMILAR_MESSAGE,k)}
|
||||
|
||||
${G}`)}return G}function f(w,x){let{compareKeys:k}=(0,v.normalizeDiffOptions)(x);return{...w,compareKeys:k}}function d(w,x,k,G){let W={...k,indent:0},se=(0,c.format)(w,W),ue=(0,c.format)(x,W);if(se===ue)return A(u.NO_DIFF_MESSAGE,G);{let ee=(0,c.format)(w,k),q=(0,c.format)(x,k);return(0,b.diffLinesUnified2)(ee.split(`
|
||||
`),q.split(`
|
||||
`),se.split(`
|
||||
`),ue.split(`
|
||||
`),G)}}})(),Ur.exports=i})()});var Be=oe((tl,Gr)=>{(()=>{"use strict";var e={"./src/Replaceable.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=je();let c=new Set(["map","array","object"]);class g{constructor(b){Ce(this,"object");Ce(this,"type");if(this.object=b,this.type=(0,o.getType)(b),!c.has(this.type))throw new Error(`Type ${this.type} is not support in Replaceable!`)}static isReplaceable(b,L){let v=(0,o.getType)(b),N=(0,o.getType)(L);return v===N&&c.has(v)}forEach(b){if(this.type==="object"){let L=Object.getOwnPropertyDescriptors(this.object);for(let v of[...Object.keys(L),...Object.getOwnPropertySymbols(L)].filter(N=>L[N].enumerable))b(this.object[v],v,this.object)}else this.object.forEach(b)}get(b){return this.type==="map"?this.object.get(b):this.object[b]}set(b,L){this.type==="map"?this.object.set(b,L):this.object[b]=L}}r.default=g}),"./src/deepCyclicCopyReplaceable.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SERIALIZABLE_PROPERTIES=void 0,r.default=v;var o=rt(),c=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol;let g=[Array,Date,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Map,Set,RegExp,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];typeof Buffer!="undefined"&&g.push(Buffer),typeof Window!="undefined"&&g.push(Window);let u=r.SERIALIZABLE_PROPERTIES=c.for("@jest/serializableProperties"),b=p=>g.includes(p.constructor),L=p=>p.constructor===Map;function v(p,E=new WeakMap){return typeof p!="object"||p===null?p:E.has(p)?E.get(p):Array.isArray(p)?_(p,E):L(p)?m(p,E):b(p)?p:o.plugins.DOMElement.test(p)?p.cloneNode(!0):N(p,E)}function N(p,E){let a=Object.create(Object.getPrototypeOf(p)),h={},l=p;do{let $=A(l);if($===void 0)h=Object.assign(Object.create(null),Object.getOwnPropertyDescriptors(l),h);else for(let C of $)h[C]||(h[C]=Object.getOwnPropertyDescriptor(l,C))}while((l=Object.getPrototypeOf(l))&&l!==Object.getPrototypeOf({}));E.set(p,a);let y=[...Object.keys(h),...Object.getOwnPropertySymbols(h)].reduce(($,C)=>{let S=h[C].enumerable;return $[C]={configurable:!0,enumerable:S,value:v(p[C],E),writable:!0},$},Object.create(null));return Object.defineProperties(a,y)}function _(p,E){let a=new(Object.getPrototypeOf(p)).constructor(p.length),h=p.length;E.set(p,a);for(let l=0;l<h;l++)a[l]=v(p[l],E);return a}function m(p,E){let a=new Map;E.set(p,a);for(let[h,l]of p)a.set(h,v(l,E));return a}function A(p){if(typeof p!="object"||p===null)return;let E=p[u];if(Array.isArray(E))return E.filter(a=>typeof a=="string"||typeof a=="symbol")}})},t={};function n(s){var r=t[s];if(r!==void 0)return r.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,n),o.exports}var i={};(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.RECEIVED_COLOR=s.INVERTED_COLOR=s.EXPECTED_COLOR=s.DIM_COLOR=s.BOLD_WEIGHT=void 0,Object.defineProperty(s,"SERIALIZABLE_PROPERTIES",{enumerable:!0,get:function(){return b.SERIALIZABLE_PROPERTIES}}),s.printReceived=s.printExpected=s.printDiffOrStringify=s.pluralize=s.matcherHint=s.matcherErrorMessage=s.highlightTrailingWhitespace=s.getLabelPrinter=s.ensureNumbers=s.ensureNoExpected=s.ensureExpectedIsNumber=s.ensureExpectedIsNonNegativeInteger=s.ensureActualIsNumber=s.diff=s.SUGGEST_TO_CONTAIN_EQUAL=void 0,s.printWithType=x,s.replaceMatchedToAsymmetricMatcher=Y,s.stringify=void 0;var r=v(Ue()),o=je(),c=qr(),g=rt(),u=v(n("./src/Replaceable.ts")),b=L(n("./src/deepCyclicCopyReplaceable.ts"));function L(H,B){if(typeof WeakMap=="function")var D=new WeakMap,U=new WeakMap;return(L=function(V,te){if(!te&&V&&V.__esModule)return V;var ne,re,ce={__proto__:null,default:V};if(V===null||typeof V!="object"&&typeof V!="function")return ce;if(ne=te?U:D){if(ne.has(V))return ne.get(V);ne.set(V,ce)}for(let le in V)le!=="default"&&{}.hasOwnProperty.call(V,le)&&((re=(ne=Object.defineProperty)&&Object.getOwnPropertyDescriptor(V,le))&&(re.get||re.set)?ne(ce,le,re):ce[le]=V[le]);return ce})(H,B)}function v(H){return H&&H.__esModule?H:{default:H}}let{AsymmetricMatcher:N,DOMCollection:_,DOMElement:m,Immutable:A,ReactElement:p,ReactTestComponent:E}=g.plugins,a=[E,p,m,_,A,N],h=s.EXPECTED_COLOR=r.default.green,l=s.RECEIVED_COLOR=r.default.red,y=s.INVERTED_COLOR=r.default.inverse,$=s.BOLD_WEIGHT=r.default.bold,C=s.DIM_COLOR=r.default.dim,S=/\n/,R="\xB7",I=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen"],j=s.SUGGEST_TO_CONTAIN_EQUAL=r.default.dim("Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead."),P=(H,B=10,D=10)=>{let V;try{V=(0,g.format)(H,{maxDepth:B,maxWidth:D,min:!0,plugins:a})}catch{V=(0,g.format)(H,{callToJSON:!1,maxDepth:B,maxWidth:D,min:!0,plugins:a})}return V.length>=1e4&&B>1?P(H,Math.floor(B/2),D):V.length>=1e4&&D>1?P(H,B,Math.floor(D/2)):V};s.stringify=P;let T=H=>H.replaceAll(/\s+$/gm,r.default.inverse("$&"));s.highlightTrailingWhitespace=T;let f=H=>H.replaceAll(/\s+$/gm,B=
Line truncated
|
||||
`:"",te=`${H} has value: ${D(B)}`;return V+te}let k=(H,B,D)=>{if(H!==void 0){let U=(D?"":"[.not]")+B;throw new Error(K(Z(U,void 0,"",D),"this matcher must not have an expected argument",x("Expected",H,w)))}};s.ensureNoExpected=k;let G=(H,B,D)=>{if(typeof H!="number"&&typeof H!="bigint"){let U=(D?"":"[.not]")+B;throw new Error(K(Z(U,void 0,void 0,D),`${l("received")} value must be a number or bigint`,x("Received",H,d)))}};s.ensureActualIsNumber=G;let W=(H,B,D)=>{if(typeof H!="number"&&typeof H!="bigint"){let U=(D?"":"[.not]")+B;throw new Error(K(Z(U,void 0,void 0,D),`${h("expected")} value must be a number or bigint`,x("Expected",H,w)))}};s.ensureExpectedIsNumber=W;let se=(H,B,D,U)=>{G(H,D,U),W(B,D,U)};s.ensureNumbers=se;let ue=(H,B,D)=>{if(typeof H!="number"||!Number.isSafeInteger(H)||H<0){let U=(D?"":"[.not]")+B;throw new Error(K(Z(U,void 0,void 0,D),`${h("expected")} value must be a non-negative integer`,x("Expected",H,w)))}};s.ensureExpectedIsNonNegativeInteger=ue;let ee=(H,B,D)=>H.reduce((U,V)=>U+(V[0]===c.DIFF_EQUAL?V[1]:V[0]===B?D?y(V[1]):V[1]:""),""),q=(H,B)=>{let D=(0,o.getType)(H),U=(0,o.getType)(B);return D!==U?!1:(0,o.isPrimitive)(H)?typeof H=="string"&&typeof B=="string"&&H.length>0&&B.length>0&&(S.test(H)||S.test(B)):!(D==="date"||D==="function"||D==="regexp"||H instanceof Error&&B instanceof Error||U==="object"&&typeof B.asymmetricMatch=="function")},z=2e4,ie=(H,B,D,U,V)=>{if(typeof H=="string"&&typeof B=="string"&&H.length>0&&B.length>0&&H.length<=z&&B.length<=z&&H!==B){if(H.includes(`
|
||||
`)||B.includes(`
|
||||
`))return(0,c.diffStringsUnified)(H,B,{aAnnotation:D,bAnnotation:U,changeLineTrailingSpaceColor:r.default.bgYellow,commonLineTrailingSpaceColor:r.default.bgYellow,emptyFirstOrLastLinePlaceholder:"\u21B5",expand:V,includeChangeCounts:!0});let ce=(0,c.diffStringsRaw)(H,B,!0),le=ce.some(he=>he[0]===c.DIFF_EQUAL),fe=O(D,U),Ae=fe(D)+w(ee(ce,c.DIFF_DELETE,le)),_e=fe(U)+d(ee(ce,c.DIFF_INSERT,le));return`${Ae}
|
||||
${_e}`}if(q(H,B)){let{replacedExpected:ce,replacedReceived:le}=Y(H,B,[],[]),fe=(0,c.diff)(ce,le,{aAnnotation:D,bAnnotation:U,expand:V,includeChangeCounts:!0});if(typeof fe=="string"&&fe.includes(`- ${D}`)&&fe.includes(`+ ${U}`))return fe}let te=O(D,U),ne=te(D)+w(H),re=te(U)+(P(H)===P(B)?"serializes to the same string":d(B));return`${ne}
|
||||
${re}`};s.printDiffOrStringify=ie;let X=(H,B)=>!(typeof H=="number"&&typeof B=="number"||typeof H=="bigint"&&typeof B=="bigint"||typeof H=="boolean"&&typeof B=="boolean");function Y(H,B,D,U){return J((0,b.default)(H),(0,b.default)(B),D,U)}function J(H,B,D,U){if(!u.default.isReplaceable(H,B))return{replacedExpected:H,replacedReceived:B};if(D.includes(H)||U.includes(B))return{replacedExpected:H,replacedReceived:B};D.push(H),U.push(B);let V=new u.default(H),te=new u.default(B);return V.forEach((ne,re)=>{let ce=te.get(re);if(M(ne))ne.asymmetricMatch(ce)&&te.set(re,ne);else if(M(ce))ce.asymmetricMatch(ne)&&V.set(re,ce);else if(u.default.isReplaceable(ne,ce)){let le=J(ne,ce,D,U);V.set(re,le.replacedExpected),te.set(re,le.replacedReceived)}}),{replacedExpected:V.object,replacedReceived:te.object}}function M(H){return(0,o.getType)(H)==="object"&&typeof H.asymmetricMatch=="function"}let F=(H,B,D)=>X(H,B)?(0,c.diff)(H,B,D):null;s.diff=F;let Q=(H,B)=>`${I[B]||B} ${H}${B===1?"":"s"}`;s.pluralize=Q;let O=(...H)=>{let B=H.reduce((D,U)=>Math.max(U.length,D),0);return D=>`${D}: ${" ".repeat(B-D.length)}`};s.getLabelPrinter=O;let K=(H,B,D)=>`${H}
|
||||
|
||||
${r.default.bold("Matcher error")}: ${B}${typeof D=="string"?`
|
||||
|
||||
${D}`:""}`;s.matcherErrorMessage=K;let Z=(H,B="received",D="expected",U={})=>{let{comment:V="",expectedColor:te=h,isDirectExpectCall:ne=!1,isNot:re=!1,promise:ce="",receivedColor:le=l,secondArgument:fe="",secondArgumentColor:Ae=h}=U,_e="",he="expect";return!ne&&B!==""&&(_e+=C(`${he}(`)+le(B),he=")"),ce!==""&&(_e+=C(`${he}.`)+ce,he=""),re&&(_e+=`${C(`${he}.`)}not`,he=""),H.includes(".")?he+=H:(_e+=C(`${he}.`)+H,he=""),D===""?he+="()":(_e+=C(`${he}(`)+te(D),fe&&(_e+=C(", ")+Ae(fe)),he=")"),V!==""&&(he+=` // ${V}`),he!==""&&(_e+=C(he)),_e};s.matcherHint=Z})(),Gr.exports=i})()});var Kr=oe((rl,Wr)=>{var Fe=require("constants"),so=process.cwd,Dt=null,io=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Dt||(Dt=so.call(process)),Dt};try{process.cwd()}catch{}typeof process.chdir=="function"&&(mn=process.chdir,process.chdir=function(e){Dt=null,mn.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,mn));var mn;Wr.exports=uo;function uo(e){Fe.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=o(e.chownSync),e.fchownSync=o(e.fchownSync),e.lchownSync=o(e.lchownSync),e.chmodSync=s(e.chmodSync),e.fchmodSync=s(e.fchmodSync),e.lchmodSync=s(e.lchmodSync),e.stat=c(e.stat),e.fstat=c(e.fstat),e.lstat=c(e.lstat),e.statSync=g(e.statSync),e.fstatSync=g(e.fstatSync),e.lstatSync=g(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(b,L,v){v&&process.nextTick(v)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(b,L,v,N){N&&process.nextTick(N)},e.lchownSync=function(){}),io==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(b){function L(v,N,_){var m=Date.now(),A=0;b(v,N,function p(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){e.stat(N,function(a,h){a&&a.code==="ENOENT"?b(v,N,p):_(E)})},A),A<100&&(A+=10);return}_&&_(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(L,b),L})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(b){function L(v,N,_,m,A,p){var E;if(p&&typeof p=="function"){var a=0;E=function(h,l,y){if(h&&h.code==="EAGAIN"&&a<10)return a++,b.call(e,v,N,_,m,A,E);p.apply(this,arguments)}}return b.call(e,v,N,_,m,A,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(L,b),L})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(b){return function(L,v,N,_,m){for(var A=0;;)try{return b.call(e,L,v,N,_,m)}catch(p){if(p.code==="EAGAIN"&&A<10){A++;continue}throw p}}})(e.readSync);function t(b){b.lchmod=function(L,v,N){b.open(L,Fe.O_WRONLY|Fe.O_SYMLINK,v,function(_,m){if(_){N&&N(_);return}b.fchmod(m,v,function(A){b.close(m,function(p){N&&N(A||p)})})})},b.lchmodSync=function(L,v){var N=b.openSync(L,Fe.O_WRONLY|Fe.O_SYMLINK,v),_=!0,m;try{m=b.fchmodSync(N,v),_=!1}finally{if(_)try{b.closeSync(N)}catch{}else b.closeSync(N)}return m}}function n(b){Fe.hasOwnProperty("O_SYMLINK")&&b.futimes?(b.lutimes=function(L,v,N,_){b.open(L,Fe.O_SYMLINK,function(m,A){if(m){_&&_(m);return}b.futimes(A,v,N,function(p){b.close(A,function(E){_&&_(p||E)})})})},b.lutimesSync=function(L,v,N){var _=b.openSync(L,Fe.O_SYMLINK),m,A=!0;try{m=b.futimesSync(_,v,N),A=!1}finally{if(A)try{b.closeSync(_)}catch{}else b.closeSync(_)}return m}):b.futimes&&(b.lutimes=function(L,v,N,_){_&&process.nextTick(_)},b.lutimesSync=function(){})}function i(b){return b&&function(L,v,N){return b.call(e,L,v,function(_){u(_)&&(_=null),N&&N.apply(this,arguments)})}}function s(b){return b&&function(L,v){try{return b.call(e,L,v)}catch(N){if(!u(N))throw N}}}function r(b){return b&&function(L,v,N,_){return b.call(e,L,v,N,function(m){u(m)&&(m=null),_&&_.apply(this,arguments)})}}function o(b){return b&&function(L,v,N){try{return b.call(e,L,v,N)}catch(_){if(!u(_))throw _}}}function c(b){return b&&function(L,v,N){typeof v=="function"&&(N=v,v=null);function _(m,A){A&&(A.uid<0&&(A.uid+=4294967296),A.gid<0&&(A.gid+=4294967296)),N&&N.apply(this,arguments)}return v?b.call(e,L,v,_):b.call(e,L,_)}}function g(b){return b&&function(L,v){var N=v?b.call(e,L,v):b.call(e,L);return N&&(N.uid<0&&(N.uid+=4294967296),N.gid<0&&(N.gid+=4294967296)),N}}function u(b){if(!b||b.code==="ENOSYS")return!0;var L=!process.getuid||process.getuid()!==0;return!!(L&&(b.code==="EINVAL"||b.code==="EPERM"))}}});var zr=oe((sl,Yr)=>{var Vr=require("stream").Stream;Yr.exports=oo;function oo(e){return{ReadStream:t,WriteStream:n};function t(i,s){if(!(this instanceof t))return new t(i,s);Vr.call(this);var r=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var o=Object.keys(s),c=0,g=o.length;c<g;c++){var u=o[c];this[u]=s[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else iLine truncated
|
||||
GFS4: `),console.error(e)});ge[ve]||(Jr=global[ve]||[],es(ge,Jr),ge.close=(function(e){function t(n,i){return e.call(ge,n,function(s){s||Zr(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,kt,{value:e}),t})(ge.close),ge.closeSync=(function(e){function t(n){e.apply(ge,arguments),Zr()}return Object.defineProperty(t,kt,{value:e}),t})(ge.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){qe(ge[ve]),require("assert").equal(ge[ve].length,0)}));var Jr;global[ve]||es(global,ge[ve]);bn.exports=hn(po(ge));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ge.__patched&&(bn.exports=hn(ge),ge.__patched=!0);function hn(e){lo(e),e.gracefulify=hn,e.createReadStream=l,e.createWriteStream=y;var t=e.readFile;e.readFile=n;function n(S,R,I){return typeof R=="function"&&(I=R,R=null),j(S,R,I);function j(P,T,f,d){return t(P,T,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Je([j,[P,T,f],w,d||Date.now(),Date.now()]):typeof f=="function"&&f.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=s;function s(S,R,I,j){return typeof I=="function"&&(j=I,I=null),P(S,R,I,j);function P(T,f,d,w,x){return i(T,f,d,function(k){k&&(k.code==="EMFILE"||k.code==="ENFILE")?Je([P,[T,f,d,w],k,x||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var r=e.appendFile;r&&(e.appendFile=o);function o(S,R,I,j){return typeof I=="function"&&(j=I,I=null),P(S,R,I,j);function P(T,f,d,w,x){return r(T,f,d,function(k){k&&(k.code==="EMFILE"||k.code==="ENFILE")?Je([P,[T,f,d,w],k,x||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=e.copyFile;c&&(e.copyFile=g);function g(S,R,I,j){return typeof I=="function"&&(j=I,I=0),P(S,R,I,j);function P(T,f,d,w,x){return c(T,f,d,function(k){k&&(k.code==="EMFILE"||k.code==="ENFILE")?Je([P,[T,f,d,w],k,x||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var u=e.readdir;e.readdir=L;var b=/^v[0-5]\./;function L(S,R,I){typeof R=="function"&&(I=R,R=null);var j=b.test(process.version)?function(f,d,w,x){return u(f,P(f,d,w,x))}:function(f,d,w,x){return u(f,d,P(f,d,w,x))};return j(S,R,I);function P(T,f,d,w){return function(x,k){x&&(x.code==="EMFILE"||x.code==="ENFILE")?Je([j,[T,f,d],x,w||Date.now(),Date.now()]):(k&&k.sort&&k.sort(),typeof d=="function"&&d.call(this,x,k))}}}if(process.version.substr(0,4)==="v0.8"){var v=fo(e);p=v.ReadStream,a=v.WriteStream}var N=e.ReadStream;N&&(p.prototype=Object.create(N.prototype),p.prototype.open=E);var _=e.WriteStream;_&&(a.prototype=Object.create(_.prototype),a.prototype.open=h),Object.defineProperty(e,"ReadStream",{get:function(){return p},set:function(S){p=S},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return a},set:function(S){a=S},enumerable:!0,configurable:!0});var m=p;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(S){m=S},enumerable:!0,configurable:!0});var A=a;Object.defineProperty(e,"FileWriteStream",{get:function(){return A},set:function(S){A=S},enumerable:!0,configurable:!0});function p(S,R){return this instanceof p?(N.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function E(){var S=this;C(S.path,S.flags,S.mode,function(R,I){R?(S.autoClose&&S.destroy(),S.emit("error",R)):(S.fd=I,S.emit("open",I),S.read())})}function a(S,R){return this instanceof a?(_.apply(this,arguments),this):a.apply(Object.create(a.prototype),arguments)}function h(){var S=this;C(S.path,S.flags,S.mode,function(R,I){R?(S.destroy(),S.emit("error",R)):(S.fd=I,S.emit("open",I))})}function l(S,R){return new e.ReadStream(S,R)}function y(S,R){return new e.WriteStream(S,R)}var $=e.open;e.open=C;function C(S,R,I,j){return typeof I=="function"&&(j=I,I=null),P(S,R,I,j);function P(T,f,d,w,x){return $(T,f,d,function(k,G){k&&(k.code==="EMFILE"||k.code==="ENFILE")?Je([P,[T,f,d,w],k,x||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return e}function Je(e){qe("ENQUEUE",e[0].name,e[1]),ge[ve].push(e),gn()}var jt;function Zr(){for(var e=Date.now(),t=0;t<ge[ve].length;++t)ge[ve][t].length>2&&(ge[ve][t][3]=e,ge[ve][t][4]=e);gn()}function gn(){if(clearTimeout(jt),jt=void 0,ge[ve].length!==0){var e=ge[ve].shift(),t=e[0],n=e[1],i=e[2],s=e[3],r=e[4];if(s===void 0)qe("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-s>=6e4){qe("TIMEOUT",t.name,n);var o=n.pop();typeof o=="function"&&o.call(null,i)}else{var c=Date.now()-r,g=Math.max(r-s,1),u=Math.min(g*1.2,100);c>=u?(qe("RETRY",t.name,n),t.apply(null,n.concat([s]))):ge[ve].push(e)}jt===void 0&&(jt=setTimeout(gn,0))}}});var ot=oe((ol,is)=>{"use strict";var ts="[^\\\\/]",ho="(?=.)",ns="[^/]",En="(?:\\/|$)",rs="(?:^|\\/)",yn=`\\.{1,2}${En}`,go="(?!\\.)",bo=`(?!${rs}${yn})`,Eo=`(?!\\.{0,1}${En})`,yo=`(?!${yn})`,_o="[^.\\/]",Ro=`${ns}*?`,Ao="/",ss={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ho,QMARK:ns,END_ANCHOR:En,DOTS_SLASH:yn,NO_DOT:go,NO_DOTS:bo,NO_DOT_SLASH:Eo,NO_DOTS_SLASH:yo,QMARK_NO_DOT:
Line truncated
|
||||
|
||||
${p.message}`,p}let A=_;for(;A=Object.getPrototypeOf(A);)typeof A.constructor=="function"&&A.constructor.call(m);return m.env=v(),m.send=()=>!0,Object.defineProperty(m,"domain",{get(){return _.domain}}),m}}),"./src/deepCyclicCopy.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;let o=new Set;function c(b,L,v=new WeakMap){return L={blacklist:o,keepPrototype:!1,...L},typeof b!="object"||b===null||Buffer.isBuffer(b)?b:v.has(b)?v.get(b):Array.isArray(b)?u(b,L,v):g(b,L,v)}function g(b,L,v){let N=L.keepPrototype?Object.create(Object.getPrototypeOf(b)):{},_=Object.getOwnPropertyDescriptors(b);v.set(b,N);for(let m of Object.keys(_)){if(L.blacklist&&L.blacklist.has(m)){delete _[m];continue}let A=_[m];A.value!==void 0&&(A.value=c(A.value,{blacklist:o,keepPrototype:L.keepPrototype},v)),A.configurable=!0}return Object.defineProperties(N,_)}function u(b,L,v){let N=L.keepPrototype?new(Object.getPrototypeOf(b)).constructor(b.length):[],_=b.length;v.set(b,N);for(let m=0;m<_;m++)N[m]=c(b[m],{blacklist:o,keepPrototype:L.keepPrototype},v);return N}}),"./src/formatTime.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c,g=-3,u=0){let b=["n","\u03BC","m",""],L=Math.max(0,Math.min(Math.trunc(g/3)+b.length-1,b.length-1));return`${String(c).padStart(u)} ${b[L]}s`}}),"./src/garbage-collection-utils.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.canDeleteProperties=N,r.deleteProperties=L,r.initializeGarbageCollectionUtils=b,r.protectProperties=v;function o(){let a=c(Ue());return o=function(){return a},a}function c(a){return a&&a.__esModule?a:{default:a}}let g=Symbol.for("$$jest-deletion-mode"),u=Symbol.for("$$jest-protect-from-deletion");function b(a,h){let l=Reflect.get(a,g);if(l&&l!==h){console.warn(o().default.yellow(["[jest-util] garbage collection deletion mode already initialized, ignoring new mode",` Current: '${l}'`,` Given: '${h}'`].join(`
|
||||
`)));return}Reflect.set(a,g,h)}function L(a){if(m()!=="off"&&N(a)){let h=E(a,Reflect.get(a,u));for(let l of Reflect.ownKeys(a))!h.includes(l)&&l!==u&&_(a,l)}}function v(a,h=[],l=2){if(m()==="off")return!1;let y=process.emitWarning;try{if(process.emitWarning=()=>{},l>=0&&N(a)&&!Reflect.has(a,u)){let $=Reflect.defineProperty(a,u,{configurable:!0,enumerable:!1,value:h,writable:!0});for(let C of E(a,h))try{let S=Reflect.get(a,C);v(S,[],l-1)}catch{}return $}return!1}finally{process.emitWarning=y}}function N(a){if(a!==null){let h=typeof a;return h==="object"||h==="function"}return!1}function _(a,h){var C,S;let l=Reflect.getOwnPropertyDescriptor(a,h);if(!(l!=null&&l.configurable))return!1;if(m()==="on")return Reflect.deleteProperty(a,h);let y=(C=l.get)!=null?C:(()=>l.value),$=(S=l.set)!=null?S:(R=>Reflect.set(a,h,R));return Reflect.defineProperty(a,h,{configurable:!0,enumerable:l.enumerable,get(){return p(a,h),y()},set(R){return p(a,h),$(R)}})}function m(){var a;return(a=Reflect.get(globalThis,g))!=null?a:"off"}let A=new WeakSet;function p(a,h){var $,C;if(A.has(a))return;let l=(C=($=a==null?void 0:a.constructor)==null?void 0:$.name)!=null?C:"unknown",y=typeof h=="symbol"?h.description:h;process.emitWarning(`'${y}' property was accessed on [${l}] after it was soft deleted`,{code:"JEST-01",detail:["Jest deletes objects that were set on the global scope between test files to reduce memory leaks.",'Currently it only "soft" deletes them and emits this warning if those objects were accessed after their deletion.','In future versions of Jest, this behavior will change to "on", which will likely fail tests.',"You can change the behavior in your test configuration now to reduce memory usage."].map(S=>` ${S}`).join(`
|
||||
`),type:"DeprecationWarning"}),A.add(a)}function E(a,h){return h===void 0?[]:(h.length>0?h:Reflect.ownKeys(a)).filter(y=>u!==y)}}),"./src/globsToMatcher.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=v;function c(){let N=u(Cs());return c=function(){return N},N}var g=u(o("./src/replacePathSepForGlob.ts"));function u(N){return N&&N.__esModule?N:{default:N}}let b=new Map,L={dot:!0};function v(N){if(N.length===0)return()=>!1;let _=N.map(m=>{if(!b.has(m)){let A=(0,c().default)(m,L,!0),p={isMatch:A,negated:A.state.negated||!!A.state.negatedExtglob};b.set(m,p)}return b.get(m)});return m=>{let A=(0,g.default)(m),p,E=0;for(let a of _){let{isMatch:h,negated:l}=a;l&&E++;let y=h(A);!y&&l?p=!1:y&&!l&&(p=!0)}return E===_.length?p!==!1:!!p}}}),"./src/installCommonGlobals.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=_;function c(){let m=v(ut());return c=function(){return m},m}var g=L(o("./src/createProcessObject.ts")),u=L(o("./src/deepCyclicCopy.ts")),b=o("./src/garbage-collection-utils.ts");function L(m){return m&&m.__esModule?m:{default:m}}function v(m,A){if(typeof WeakMap=="function")var p=new WeakMap,E=new WeakMap;return(v=function(a,h){if(!h&&a&&a.__esModule)return a;var l,y,$={__proto__:null,default:a};if(a===null||typeof a!="object"&&typeof a!="function")return $;if(l=h?E:p){if(l.has(a))return l.get(a);l.set(a,$)}for(let C in a)C!=="default"&&{}.hasOwnProperty.call(a,C)&&((y=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(a,C))&&(y.get||y.set)?l($,C,y):$[C]=a[C]);return $})(m,A)}let N=Object.keys(globalThis).filter(m=>m.startsWith("DTRACE"));function _(m,A,p){m.process=(0,g.default)();let E=m.Symbol;Object.defineProperties(m,{[E.for("jest-native-promise")]:{enumerable:!1,value:Promise,writable:!1},[E.for("jest-native-now")]:{enumerable:!1,value:m.Date.now.bind(m.Date),writable:!1},[E.for("jest-native-read-file")]:{enumerable:!1,value:c().readFileSync.bind(c()),writable:!1},[E.for("jest-native-write-file")]:{enumerable:!1,value:c().writeFileSync.bind(c()),writable:!1},[E.for("jest-native-exists-file")]:{enumerable:!1,value:c().existsSync.bind(c()),writable:!1},"jest-symbol-do-not-touch":{enumerable:!1,value:E,writable:!1}});for(let a of N)m[a]=function(...h){return globalThis[a].apply(this,h)};return p&&(0,b.initializeGarbageCollectionUtils)(m,p),Object.assign(m,(0,u.default)(A))}}),"./src/interopRequireDefault.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c){return c&&c.__esModule?c:{default:c}}}),"./src/invariant.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c,g=""){if(!c)throw new Error(g)}}),"./src/isInteractive.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;function o(){let b=Ts();return o=function(){return b},b}function c(){return o().isCI||process.stdout==null?!1:process.stdout.isTTY?process.env.TERM!=="dumb":!1}let g=c();var u=r.default=g}),"./src/isNonNullable.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c){return c!=null}}),"./src/isPromise.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c){return c!=null&&(typeof c=="object"||typeof c=="function")&&typeof c.then=="function"}}),"./src/pluralize.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c,g,u="s"){return`${g} ${c}${g===1?"":u}`}}),"./src/preRunMessage.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.print=L,r.remove=v;function c(){let N=b(Ue());return c=function(){return N},N}var g=b(o("./src/clearLine.ts")),u=b(o("./src/isInteractive.ts"));function b(N){return N&&N.__esModule?N:{default:N}}function L(N){u.default&&N.write(c().default.bold.dim("Determining test suites to run..."))}function v(N){u.default&&(0,g.default)(N)}}),"./src/replacePathSepForGlob.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;function o(c){return c.replaceAll(/\\(?![$()+.?^{}])/g,"/")}}),"./src/requireOrImportModule.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=v;function c(){let N=require("path");return c=function(){return N},N}function g(){let N=require("url");return g=function(){return N},N}var u=b(o("./src/interopRequireDefault.ts"));function b(N){return N&&N.__esModule?N:{default:N}}async function L(N,_){try{let A=await import((0,g().pathToFileURL)(N).href);if(!_)return A;if(!A.default)throw new Error(`Jest: Failed to load ESM at ${N} - did you use a default export?`);return A.default}catch(m){throw m.message==="Not supported"?new Error(`Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file ${N}`):m}}async function v(N,_=!0){if(!(0,c().isAbsolute)(N)&&N[0]===".")throw new Error(`Jest: requireOrImportModule path must be absolute, was "${N}"`);try{if(N.endsWith(".mjs"))return L(N,_);let m=require(N);return _?(0,u.default)(m).default:m}catch(m){if(m.code==="E
Line truncated
|
||||
`):n+=s;return n}var Ws=!1,Ks=/\r\n|[\n\r\u2028\u2029]/;function la(e,t,n){let i=Object.assign({column:0,line:-1},e.start),s=Object.assign({},i,e.end),{linesAbove:r=2,linesBelow:o=3}=n||{},c=i.line,g=i.column,u=s.line,b=s.column,L=Math.max(c-(r+1),0),v=Math.min(t.length,u+o);c===-1&&(L=0),u===-1&&(v=t.length);let N=u-c,_={};if(N)for(let m=0;m<=N;m++){let A=m+c;if(!g)_[A]=!0;else if(m===0){let p=t[A-1].length;_[A]=[g,p-g+1]}else if(m===N)_[A]=[0,b];else{let p=t[A-m].length;_[A]=[0,p]}}else g===b?g?_[c]=[g,0]:_[c]=!0:_[c]=[g,b-g];return{start:L,end:v,markerLines:_}}function Qs(e,t,n={}){let i=n.forceColor||sa()&&n.highlightCode,s=Ys(i),r=e.split(Ks),{start:o,end:c,markerLines:g}=la(t,r,n),u=t.start&&typeof t.start.column=="number",b=String(c).length,v=(i?Xs(e):e).split(Ks,c).slice(o,c).map((N,_)=>{let m=o+1+_,p=` ${` ${m}`.slice(-b)} |`,E=g[m],a=!g[m+1];if(E){let h="";if(Array.isArray(E)){let l=N.slice(0,Math.max(E[0]-1,0)).replace(/[^\t]/g," "),y=E[1]||1;h=[`
|
||||
`,s.gutter(p.replace(/\d/g," "))," ",l,s.marker("^").repeat(y)].join(""),a&&n.message&&(h+=" "+s.message(n.message))}return[s.marker(">"),s.gutter(p),N.length>0?` ${N}`:"",h].join("")}else return` ${s.gutter(p)}${N.length>0?` ${N}`:""}`}).join(`
|
||||
`);return n.message&&!u&&(v=`${" ".repeat(b+1)}${n.message}
|
||||
${v}`),i?s.reset(v):v}function fa(e,t,n,i={}){if(!Ws){Ws=!0;let r="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning)process.emitWarning(r,"DeprecationWarning");else{let o=new Error(r);o.name="DeprecationWarning",console.warn(new Error(r))}}return n=Math.max(n,0),Qs(e,{start:{column:n,line:t}},i)}pt.codeFrameColumns=Qs;pt.default=fa;pt.highlight=Xs});var Kt=oe(Ne=>{"use strict";Ne.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;Ne.find=(e,t)=>e.nodes.find(n=>n.type===t);Ne.exceedsLimit=(e,t,n=1,i)=>i===!1||!Ne.isInteger(e)||!Ne.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=i;Ne.escapeNode=(e,t=0,n)=>{let i=e.nodes[t];i&&(n&&i.type===n||i.type==="open"||i.type==="close")&&i.escaped!==!0&&(i.value="\\"+i.value,i.escaped=!0)};Ne.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;Ne.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;Ne.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;Ne.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);Ne.flatten=(...e)=>{let t=[],n=i=>{for(let s=0;s<i.length;s++){let r=i[s];if(Array.isArray(r)){n(r);continue}r!==void 0&&t.push(r)}return t};return n(e),t}});var Vt=oe((Cl,ei)=>{"use strict";var Zs=Kt();ei.exports=(e,t={})=>{let n=(i,s={})=>{let r=t.escapeInvalid&&Zs.isInvalidBrace(s),o=i.invalid===!0&&t.escapeInvalid===!0,c="";if(i.value)return(r||o)&&Zs.isOpenOrClose(i)?"\\"+i.value:i.value;if(i.value)return i.value;if(i.nodes)for(let g of i.nodes)c+=n(g);return c};return n(e)}});var ni=oe((vl,ti)=>{"use strict";ti.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var fi=oe((Sl,li)=>{"use strict";var ri=ni(),We=(e,t,n)=>{if(ri(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(ri(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...n};typeof i.strictZeros=="boolean"&&(i.relaxZeros=i.strictZeros===!1);let s=String(i.relaxZeros),r=String(i.shorthand),o=String(i.capture),c=String(i.wrap),g=e+":"+t+"="+s+r+o+c;if(We.cache.hasOwnProperty(g))return We.cache[g].result;let u=Math.min(e,t),b=Math.max(e,t);if(Math.abs(u-b)===1){let m=e+"|"+t;return i.capture?`(${m})`:i.wrap===!1?m:`(?:${m})`}let L=ci(e)||ci(t),v={min:e,max:t,a:u,b},N=[],_=[];if(L&&(v.isPadded=L,v.maxLen=String(v.max).length),u<0){let m=b<0?Math.abs(b):1;_=si(m,Math.abs(u),v,i),u=v.a=0}return b>=0&&(N=si(u,b,v,i)),v.negatives=_,v.positives=N,v.result=pa(_,N,i),i.capture===!0?v.result=`(${v.result})`:i.wrap!==!1&&N.length+_.length>1&&(v.result=`(?:${v.result})`),We.cache[g]=v,v.result};function pa(e,t,n){let i=Pn(e,t,"-",!1,n)||[],s=Pn(t,e,"",!1,n)||[],r=Pn(e,t,"-?",!0,n)||[];return i.concat(r).concat(s).join("|")}function da(e,t){let n=1,i=1,s=ui(e,n),r=new Set([t]);for(;e<=s&&s<=t;)r.add(s),n+=1,s=ui(e,n);for(s=oi(t+1,i)-1;e<s&&s<=t;)r.add(s),i+=1,s=oi(t+1,i)-1;return r=[...r],r.sort(ga),r}function ma(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let i=ha(e,t),s=i.length,r="",o=0;for(let c=0;c<s;c++){let[g,u]=i[c];g===u?r+=g:g!=="0"||u!=="9"?r+=ba(g,u,n):o++}return o&&(r+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:r,count:[o],digits:s}}function si(e,t,n,i){let s=da(e,t),r=[],o=e,c;for(let g=0;g<s.length;g++){let u=s[g],b=ma(String(o),String(u),i),L="";if(!n.isPadded&&c&&c.pattern===b.pattern){c.count.length>1&&c.count.pop(),c.count.push(b.count[0]),c.string=c.pattern+ai(c.count),o=u+1;continue}n.isPadded&&(L=Ea(u,n,i)),b.string=L+b.pattern+ai(b.count),r.push(b),o=u+1,c=b}return r}function Pn(e,t,n,i,s){let r=[];for(let o of e){let{string:c}=o;!i&&!ii(t,"string",c)&&r.push(n+c),i&&ii(t,"string",c)&&r.push(n+c)}return r}function ha(e,t){let n=[];for(let i=0;i<e.length;i++)n.push([e[i],t[i]]);return n}function ga(e,t){return e>t?1:t>e?-1:0}function ii(e,t,n){return e.some(i=>i[t]===n)}function ui(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function oi(e,t){return e-e%Math.pow(10,t)}function ai(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function ba(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function ci(e){return/^-?(0+)\d/.test(e)}function Ea(e,t,n){if(!t.isPadded)return e;let i=Math.abs(t.maxLen-String(e).length),s=n.relaxZeros!==!1;switch(i){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${i}}`:`0{${i}}`}}We.cache={};We.clearCache=()=>We.cache={};li.exports=We});var Hn=oe((Ol,Ei)=>{"use strict";var ya=require("util"),di=fi(),pi=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),_a=e=>t=>e===!0?Number(t):String(t),xn=e=>typeof e=="number"||typeof e=="string"&&e!=="",dt=e=>N
Line truncated
|
||||
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Ni=oe((Ll,Li)=>{"use strict";var Na=Vt(),{MAX_LENGTH:Ti,CHAR_BACKSLASH:jn,CHAR_BACKTICK:Ia,CHAR_COMMA:Ma,CHAR_DOT:Pa,CHAR_LEFT_PARENTHESES:xa,CHAR_RIGHT_PARENTHESES:Da,CHAR_LEFT_CURLY_BRACE:Ha,CHAR_RIGHT_CURLY_BRACE:ja,CHAR_LEFT_SQUARE_BRACKET:wi,CHAR_RIGHT_SQUARE_BRACKET:$i,CHAR_DOUBLE_QUOTE:ka,CHAR_SINGLE_QUOTE:Ba,CHAR_NO_BREAK_SPACE:Fa,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ua}=Oi(),qa=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},i=typeof n.maxLength=="number"?Math.min(Ti,n.maxLength):Ti;if(e.length>i)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${i})`);let s={type:"root",input:e,nodes:[]},r=[s],o=s,c=s,g=0,u=e.length,b=0,L=0,v,N=()=>e[b++],_=m=>{if(m.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&m.type==="text"){c.value+=m.value;return}return o.nodes.push(m),m.parent=o,m.prev=c,c=m,m};for(_({type:"bos"});b<u;)if(o=r[r.length-1],v=N(),!(v===Ua||v===Fa)){if(v===jn){_({type:"text",value:(t.keepEscaping?v:"")+N()});continue}if(v===$i){_({type:"text",value:"\\"+v});continue}if(v===wi){g++;let m;for(;b<u&&(m=N());){if(v+=m,m===wi){g++;continue}if(m===jn){v+=N();continue}if(m===$i&&(g--,g===0))break}_({type:"text",value:v});continue}if(v===xa){o=_({type:"paren",nodes:[]}),r.push(o),_({type:"text",value:v});continue}if(v===Da){if(o.type!=="paren"){_({type:"text",value:v});continue}o=r.pop(),_({type:"text",value:v}),o=r[r.length-1];continue}if(v===ka||v===Ba||v===Ia){let m=v,A;for(t.keepQuotes!==!0&&(v="");b<u&&(A=N());){if(A===jn){v+=A+N();continue}if(A===m){t.keepQuotes===!0&&(v+=A);break}v+=A}_({type:"text",value:v});continue}if(v===Ha){L++;let A={type:"brace",open:!0,close:!1,dollar:c.value&&c.value.slice(-1)==="$"||o.dollar===!0,depth:L,commas:0,ranges:0,nodes:[]};o=_(A),r.push(o),_({type:"open",value:v});continue}if(v===ja){if(o.type!=="brace"){_({type:"text",value:v});continue}let m="close";o=r.pop(),o.close=!0,_({type:m,value:v}),L--,o=r[r.length-1];continue}if(v===Ma&&L>0){if(o.ranges>0){o.ranges=0;let m=o.nodes.shift();o.nodes=[m,{type:"text",value:Na(o)}]}_({type:"comma",value:v}),o.commas++;continue}if(v===Pa&&L>0&&o.commas===0){let m=o.nodes;if(L===0||m.length===0){_({type:"text",value:v});continue}if(c.type==="dot"){if(o.range=[],c.value+=v,c.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,c.type="text";continue}o.ranges++,o.args=[];continue}if(c.type==="range"){m.pop();let A=m[m.length-1];A.value+=c.value+v,c=A,o.ranges--;continue}_({type:"dot",value:v});continue}_({type:"text",value:v})}do if(o=r.pop(),o.type!=="root"){o.nodes.forEach(p=>{p.nodes||(p.type==="open"&&(p.isOpen=!0),p.type==="close"&&(p.isClose=!0),p.nodes||(p.type="text"),p.invalid=!0)});let m=r[r.length-1],A=m.nodes.indexOf(o);m.nodes.splice(A,1,...o.nodes)}while(r.length>0);return _({type:"eos"}),s};Li.exports=qa});var Pi=oe((Nl,Mi)=>{"use strict";var Ii=Vt(),Ga=Ri(),Wa=vi(),Ka=Ni(),Te=(e,t={})=>{let n=[];if(Array.isArray(e))for(let i of e){let s=Te.create(i,t);Array.isArray(s)?n.push(...s):n.push(s)}else n=[].concat(Te.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};Te.parse=(e,t={})=>Ka(e,t);Te.stringify=(e,t={})=>Ii(typeof e=="string"?Te.parse(e,t):e,t);Te.compile=(e,t={})=>(typeof e=="string"&&(e=Te.parse(e,t)),Ga(e,t));Te.expand=(e,t={})=>{typeof e=="string"&&(e=Te.parse(e,t));let n=Wa(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};Te.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?Te.compile(e,t):Te.expand(e,t);Mi.exports=Te});var mt=oe((Il,ki)=>{"use strict";var Va=require("path"),xe="\\\\/",xi=`[^${xe}]`,He="\\.",Ya="\\+",za="\\?",Xt="\\/",Xa="(?=.)",Di="[^/]",kn=`(?:${Xt}|$)`,Hi=`(?:^|${Xt})`,Bn=`${He}{1,2}${kn}`,Qa=`(?!${He})`,Ja=`(?!${Hi}${Bn})`,Za=`(?!${He}{0,1}${kn})`,ec=`(?!${Bn})`,tc=`[^.${Xt}]`,nc=`${Di}*?`,ji={DOT_LITERAL:He,PLUS_LITERAL:Ya,QMARK_LITERAL:za,SLASH_LITERAL:Xt,ONE_CHAR:Xa,QMARK:Di,END_ANCHOR:kn,DOTS_SLASH:Bn,NO_DOT:Qa,NO_DOTS:Ja,NO_DOT_SLASH:Za,NO_DOTS_SLASH:ec,QMARK_NO_DOT:tc,STAR:nc,START_ANCHOR:Hi},rc={...ji,SLASH_LITERAL:`[${xe}]`,QMARK:xi,STAR:`${xi}*?`,DOTS_SLASH:`${He}{1,2}(?:[${xe}]|$)`,NO_DOT:`(?!${He})`,NO_DOTS:`(?!(?:^|[${xe}])${He}{1,2}(?:[${xe}]|$))`,NO_DOT_SLASH:`(?!${He}{0,1}(?:[${xe}]|$))`,NO_DOTS_SLASH:`(?!${He}{1,2}(?:[${xe}]|$))`,QMARK_NO_DOT:`[^.${xe}]`,START_ANCHOR:`(?:^|[${xe}])`,END_ANCHOR:`(?:[${xe}]|$)`},sc={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:Line truncated
|
||||
`)),!/^\s*at /.test(t[0])&&/^\s*at /.test(t[1])&&(t=t.slice(1));let i=!1,s=null,r=[];return t.forEach(o=>{if(o=o.replace(/\\/g,"/"),this._internals.some(g=>g.test(o)))return;let c=/^\s*at /.test(o);i?o=o.trimEnd().replace(/^(\s+)at /,"$1"):(o=o.trim(),c&&(o=o.slice(3))),o=o.replace(`${this._cwd}/`,""),o&&(c?(s&&(r.push(s),s=null),r.push(o)):(i=!0,s=o))}),r.map(o=>`${n}${o}
|
||||
`).join("")}captureString(t,n=this.captureString){typeof t=="function"&&(n=t,t=1/0);let{stackTraceLimit:i}=Error;t&&(Error.stackTraceLimit=t);let s={};Error.captureStackTrace(s,n);let{stack:r}=s;return Error.stackTraceLimit=i,this.clean(r)}capture(t,n=this.capture){typeof t=="function"&&(n=t,t=1/0);let{prepareStackTrace:i,stackTraceLimit:s}=Error;Error.prepareStackTrace=(c,g)=>this._wrapCallSite?g.map(this._wrapCallSite):g,t&&(Error.stackTraceLimit=t);let r={};Error.captureStackTrace(r,n);let{stack:o}=r;return Object.assign(Error,{prepareStackTrace:i,stackTraceLimit:s}),o}at(t=this.at){let[n]=this.capture(1,t);if(!n)return{};let i={line:n.getLineNumber(),column:n.getColumnNumber()};fu(i,n.getFileName(),this._cwd),n.isConstructor()&&Object.defineProperty(i,"constructor",{value:!0,configurable:!0}),n.isEval()&&(i.evalOrigin=n.getEvalOrigin()),n.isNative()&&(i.native=!0);let s;try{s=n.getTypeName()}catch{}s&&s!=="Object"&&s!=="[object Object]"&&(i.type=s);let r=n.getFunctionName();r&&(i.function=r);let o=n.getMethodName();return o&&r!==o&&(i.method=o),i}parseLine(t){let n=t&&t.match(Lc);if(!n)return null;let i=n[1]==="new",s=n[2],r=n[3],o=n[4],c=Number(n[5]),g=Number(n[6]),u=n[7],b=n[8],L=n[9],v=n[10]==="native",N=n[11]===")",_,m={};if(b&&(m.line=Number(b)),L&&(m.column=Number(L)),N&&u){let A=0;for(let p=u.length-1;p>0;p--)if(u.charAt(p)===")")A++;else if(u.charAt(p)==="("&&u.charAt(p-1)===" "&&(A--,A===-1&&u.charAt(p-1)===" ")){let E=u.slice(0,p-1);u=u.slice(p+1),s+=` (${E}`;break}}if(s){let A=s.match(Nc);A&&(s=A[1],_=A[2])}return fu(m,u,this._cwd),i&&Object.defineProperty(m,"constructor",{value:!0,configurable:!0}),r&&(m.evalOrigin=r,m.evalLine=c,m.evalColumn=g,m.evalFile=o&&o.replace(/\\/g,"/")),v&&(m.native=!0),s&&(m.function=s),_&&s!==_&&(m.method=_),m}};function fu(e,t,n){t&&(t=t.replace(/\\/g,"/"),t.startsWith(`${n}/`)&&(t=t.slice(n.length+1)),e.file=t)}function $c(e){if(e.length===0)return[];let t=e.map(n=>Tc(n));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${t.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var Lc=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),Nc=/^(.*?) \[as (.*?)\]$/;du.exports=Xn});var gu=oe((Ul,hu)=>{(()=>{"use strict";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.formatResultsErrors=t.formatPath=t.formatExecError=void 0,t.formatStackTrace=M,t.getStackTraceLines=Y,t.getTopFrame=J,t.separateMessageFromStack=t.indentAllLines=void 0;var n=N(require("path")),i=require("url"),s=require("util"),r=Js(),o=v(Ue()),c=N(ut()),g=v(uu()),u=v(au()),b=v(mu()),L=rt();function v(D){return D&&D.__esModule?D:{default:D}}function N(D,U){if(typeof WeakMap=="function")var V=new WeakMap,te=new WeakMap;return(N=function(ne,re){if(!re&&ne&&ne.__esModule)return ne;var ce,le,fe={__proto__:null,default:ne};if(ne===null||typeof ne!="object"&&typeof ne!="function")return fe;if(ce=re?te:V){if(ce.has(ne))return ce.get(ne);ce.set(ne,fe)}for(let Ae in ne)Ae!=="default"&&{}.hasOwnProperty.call(ne,Ae)&&((le=(ce=Object.defineProperty)&&Object.getOwnPropertyDescriptor(ne,Ae))&&(le.get||le.set)?ce(fe,Ae,le):fe[Ae]=ne[Ae]);return fe})(D,U)}var _=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,_=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,m=globalThis[_.for("jest-native-read-file")]||c.readFileSync;let A=new b.default({cwd:"something which does not exist"}),p=[];try{p=b.default.nodeInternals()}catch{}let E=`${n.sep}node_modules${n.sep}`,a=`${n.sep}jest${n.sep}packages${n.sep}`,h=/^\s+at(?:(?:.jasmine-)|\s+jasmine\.buildExpectationResult)/,l=/^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/,y=/^\s+at <anonymous>.*$/,$=/^\s+at (new )?Promise \(<anonymous>\).*$/,C=/^\s+at Generator.next \(<anonymous>\).*$/,S=/^\s+at next \(native\).*$/,R=" ",I=" ",j=" ",P=" \u203A ",T=o.default.bold("\u25CF "),f=o.default.dim,d=/\s*at.*\(?(:\d*:\d*|native)\)?/,w="Test suite failed to run",x=/^(?!$)/gm,k=D=>D.replaceAll(x,I);t.indentAllLines=k;let G=D=>(D||"").trim(),W=D=>d.test(D)?G(D):D,se=(D,U,V)=>{let te=(0,r.codeFrameColumns)(D,{start:{column:V,line:U}},{highlightCode:!0});return te=k(te),te=`
|
||||
${te}
|
||||
`,te},ue=/^\s*$/;function ee(D){return D.includes("ReferenceError: document is not defined")||D.includes("ReferenceError: window is not defined")||D.includes("ReferenceError: navigator is not defined")?q(D,"jsdom"):D.includes(".unref is not a function")?q(D,"node"):D}function q(D,U){return o.default.bold.red(`The error below may be caused by using the wrong test environment, see ${o.default.dim.underline("https://jestjs.io/docs/configuration#testenvironment-string")}.
|
||||
Consider using the "${U}" test environment.
|
||||
|
||||
`)+D}let z=(D,U,V,te,ne,re)=>{(!D||typeof D=="number")&&(D=new Error(`Expected an Error, but "${String(D)}" was thrown`),D.stack="");let ce,le,fe="",Ae=[];if(typeof D=="string"||!D)D||(D="EMPTY ERROR"),ce="",le=D;else{if(ce=D.message,le=typeof D.stack=="string"?D.stack:`thrown: ${(0,L.format)(D,{maxDepth:3})}`,"cause"in D){let yt=`
|
||||
|
||||
Cause:
|
||||
`;if(typeof D.cause=="string"||typeof D.cause=="number")fe+=`${yt}${D.cause}`;else if(s.types.isNativeError(D.cause)||D.cause instanceof Error){let Ru=z(D.cause,U,V,te,ne,!0);fe+=`${yt}${Ru}`}}if("errors"in D&&Array.isArray(D.errors))for(let yt of D.errors)Ae.push(z(yt,U,V,te,ne,!0))}fe!==""&&(fe=k(fe));let _e=B(le||"");le=_e.stack,_e.message.includes(G(ce))&&(ce=_e.message),ce=ee(ce),ce=k(ce),le=le&&!V.noStackTrace?`
|
||||
${M(le,U,V,te)}`:"",(typeof le!="string"||ue.test(ce)&&ue.test(le))&&(ce=`thrown: ${(0,L.format)(D,{maxDepth:3})}`);let he;ne||re?he=` ${ce.trim()}`:he=`${w}
|
||||
|
||||
${ce}`;let Et=re?"":`${R+T}`,_u=Ae.length>0?k(`
|
||||
|
||||
Errors contained in AggregateError:
|
||||
${Ae.join(`
|
||||
`)}`):"";return`${Et+he+le+fe+_u}
|
||||
`};t.formatExecError=z;let ie=(D,U)=>{let V=0;return D.filter(te=>!te||y.test(te)||$.test(te)||C.test(te)||S.test(te)||p.some(ne=>ne.test(te))?!1:d.test(te)?h.test(te)?!1:++V===1?!0:!(U.noStackTrace||l.test(te)):!0)},X=(D,U,V=null)=>{let te=D.match(/(^\s*at .*?\(?)([^()]+)(:\d+:\d+\)?.*$)/);if(!te)return D;let ne=(0,u.default)(n.relative(U.rootDir,te[2]));return(U.testMatch&&U.testMatch.length>0&&(0,g.default)([ne],U.testMatch).length>0||ne===V)&&(ne=o.default.reset.cyan(ne)),f(te[1])+ne+f(te[3])};t.formatPath=X;function Y(D,U){return U={noCodeFrame:!1,noStackTrace:!1,...U},ie(D.split(/\n/),U)}function J(D){for(let U of D){if(U.includes(E)||U.includes(a))continue;let V=A.parseLine(U.trim());if(V&&V.file)return V.file.startsWith("file://")&&(V.file=(0,u.default)((0,i.fileURLToPath)(V.file))),V}return null}function M(D,U,V,te){let ne=Y(D,V),re="",ce=te?(0,u.default)(n.relative(U.rootDir,te)):null;if(!V.noStackTrace&&!V.noCodeFrame){let fe=J(ne);if(fe){let{column:Ae,file:_e,line:he}=fe;if(he&&_e&&n.isAbsolute(_e)){let Et;try{Et=m(_e,"utf8"),re=se(Et,he,Ae)}catch{}}}}let le=ne.length===0?"":`
|
||||
${ne.map(fe=>j+X(W(fe),U,ce)).join(`
|
||||
`)}`;return re+le}function F(D){return typeof D!="string"&&"cause"in D&&(typeof D.cause=="string"||s.types.isNativeError(D.cause)||D.cause instanceof Error)}function Q(D,U,V,te){let ne=typeof D=="string"?D:D.stack||"",{message:re,stack:ce}=B(ne);ce=V.noStackTrace?"":`${f(M(ce,U,V,te))}
|
||||
`,re=ee(re),re=k(re);let le="";if(F(D)){let fe=Q(D.cause,U,V,te);le=`
|
||||
${I}Cause:
|
||||
${fe}`}return`${re}
|
||||
${ce}${le}`}function O(D,U){return D?s.types.isNativeError(D)||D instanceof Error?D:typeof D=="object"&&"error"in D&&(s.types.isNativeError(D.error)||D.error instanceof Error)?D.error:U:U}let K=(D,U,V,te)=>{let ne=D.flatMap(re=>re.failureMessages.map((ce,le)=>({content:ce,failureDetails:re.failureDetails[le],result:re})));return ne.length===0?null:ne.map(({result:re,content:ce,failureDetails:le})=>{let fe=O(le,ce);return`${`${o.default.bold.red(R+T+re.ancestorTitles.join(P)+(re.ancestorTitles.length>0?P:"")+re.title)}
|
||||
`}
|
||||
${Q(fe,U,V,te)}`}).join(`
|
||||
`)};t.formatResultsErrors=K;let Z=/^Error:?\s*$/,H=D=>D.split(`
|
||||
`).filter(U=>!Z.test(U)).join(`
|
||||
`).trimEnd(),B=D=>{if(!D)return{message:"",stack:""};let U=D.match(/^(?:Error: )?([\S\s]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\S\s]*)$/);if(!U)throw new Error("If you hit this error, the regex above is buggy.");let V=H(U[1]),te=H(U[2]);return{message:V,stack:te}};t.separateMessageFromStack=B})(),hu.exports=e})()});var Eu=oe((ql,bu)=>{(()=>{"use strict";var e={"./src/asymmetricMatchers.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.closeTo=r.arrayOf=r.arrayNotContaining=r.arrayContaining=r.anything=r.any=r.AsymmetricMatcher=void 0,r.hasProperty=A,r.stringNotMatching=r.stringNotContaining=r.stringMatching=r.stringContaining=r.objectNotContaining=r.objectContaining=r.notCloseTo=r.notArrayOf=void 0;var c=Ve(),g=L(Be()),u=Tn(),b=o("./src/jestMatchersObject.ts");function L(ee,q){if(typeof WeakMap=="function")var z=new WeakMap,ie=new WeakMap;return(L=function(X,Y){if(!Y&&X&&X.__esModule)return X;var J,M,F={__proto__:null,default:X};if(X===null||typeof X!="object"&&typeof X!="function")return F;if(J=Y?ie:z){if(J.has(X))return J.get(X);J.set(X,F)}for(let Q in X)Q!=="default"&&{}.hasOwnProperty.call(X,Q)&&((M=(J=Object.defineProperty)&&Object.getOwnPropertyDescriptor(X,Q))&&(M.get||M.set)?J(F,Q,M):F[Q]=X[Q]);return F})(ee,q)}var v=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol;let N=Function.prototype.toString;function _(ee){if(ee.name)return ee.name;let q=N.call(ee).match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/);return q?q[1]:"<anonymous>"}let m=Object.freeze({...g,iterableEquality:c.iterableEquality,subsetEquality:c.subsetEquality});function A(ee,q){return ee?Object.prototype.hasOwnProperty.call(ee,q)?!0:A(Object.getPrototypeOf(ee),q):!1}class p{constructor(q,z=!1){Ce(this,"$$typeof",v.for("jest.asymmetricMatcher"));this.sample=q,this.inverse=z}getMatcherContext(){return{customTesters:(0,b.getCustomEqualityTesters)(),dontThrow:()=>{},...(0,b.getState)(),equals:c.equals,isNot:this.inverse,utils:m}}}r.AsymmetricMatcher=p;class E extends p{constructor(q){if(q===void 0)throw new TypeError("any() expects to be passed a constructor function. Please pass one or use anything() to match any object.");super(q)}asymmetricMatch(q){return this.sample===String?typeof q=="string"||q instanceof String:this.sample===Number?typeof q=="number"||q instanceof Number:this.sample===Function?typeof q=="function"||q instanceof Function:this.sample===Boolean?typeof q=="boolean"||q instanceof Boolean:this.sample===BigInt?typeof q=="bigint"||q instanceof BigInt:this.sample===v?typeof q=="symbol"||q instanceof v:this.sample===Object?typeof q=="object":this.sample===Array?Array.isArray(q):q instanceof this.sample}toString(){return"Any"}getExpectedType(){return this.sample===String?"string":this.sample===Number?"number":this.sample===Function?"function":this.sample===Object?"object":this.sample===Boolean?"boolean":this.sample===Array?"array":_(this.sample)}toAsymmetricMatcher(){return`Any<${_(this.sample)}>`}}class a extends p{asymmetricMatch(q){return q!=null}toString(){return"Anything"}toAsymmetricMatcher(){return"Anything"}}class h extends p{constructor(q,z=!1){super(q,z)}asymmetricMatch(q){if(!Array.isArray(this.sample))throw new TypeError(`You must provide an array to ${this.toString()}, not '${typeof this.sample}'.`);let z=this.getMatcherContext(),ie=this.sample.length===0||Array.isArray(q)&&this.sample.every(X=>q.some(Y=>(0,c.equals)(X,Y,z.customTesters)));return this.inverse?!ie:ie}toString(){return`Array${this.inverse?"Not":""}Containing`}getExpectedType(){return"array"}}class l extends p{asymmetricMatch(q){let z=this.getMatcherContext(),ie=Array.isArray(q)&&q.every(X=>(0,c.equals)(this.sample,X,z.customTesters));return this.inverse?!ie:ie}toString(){return`${this.inverse?"Not":""}ArrayOf`}getExpectedType(){return"array"}}class y extends p{constructor(q,z=!1){super(q,z)}asymmetricMatch(q){if(typeof this.sample!="object")throw new TypeError(`You must provide an object to ${this.toString()}, not '${typeof this.sample}'.`);if(typeof q!="object"||Array.isArray(q))return!1;let z=!0,ie=this.getMatcherContext(),X=(0,c.getObjectKeys)(this.sample);for(let Y of X)if(!A(q,Y)||!(0,c.equals)(this.sample[Y],q[Y],ie.customTesters)){z=!1;break}return this.inverse?!z:z}toString(){return`Object${this.inverse?"Not":""}Containing`}getExpectedType(){return"object"}}class $ extends p{constructor(q,z=!1){if(!(0,c.isA)("String",q))throw new Error("Expected is not a string");super(q,z)}asymmetricMatch(q){let z=(0,c.isA)("String",q)&&q.includes(this.sample);return this.inverse?!z:z}toString(){return`String${this.inverse?"Not":""}Containing`}getExpectedType(){return"string"}}class C extends p{constructor(q,z=!1){if(!(0,c.isA)("String",q)&&!(0,c.isA)("RegExp",q))throw new Error("Expected is not a String or a RegExp");super(new RegExp(q),z)}asymmetricMatch(q){let z=(0,c.isA)("String",q)&&this.sample.test(q);return this.inverse?!z:z}toString(){return`String${this.inverse?"Not":""}Matching`}getExpectedType(){return"string"}}class S e
Line truncated
|
||||
|
||||
Expected ${E} to be called but received ${(0,c.RECEIVED_COLOR)((0,c.pluralize)("assertion call",N||0))}.`,v.push({actual:N.toString(),error:m,expected:_.toString()})}if(A&&N===0){let E=(0,c.EXPECTED_COLOR)("at least one assertion"),a=(0,c.RECEIVED_COLOR)("received none");p.message=`${(0,c.matcherHint)(".hasAssertions","","",{isDirectExpectCall:!0})}
|
||||
|
||||
Expected ${E} to be called but ${a}.`,v.push({actual:"none",error:p,expected:"at least one"})}return v};var L=r.default=b}),"./src/jestMatchersObject.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.setState=r.setMatchers=r.getState=r.getMatchers=r.getCustomEqualityTesters=r.addCustomEqualityTesters=r.INTERNAL_MATCHER_FLAG=void 0;var c=je(),g=o("./src/asymmetricMatchers.ts"),u=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol;let b=u.for("$$jest-matchers-object"),L=r.INTERNAL_MATCHER_FLAG=u.for("$$jest-internal-matcher");Object.prototype.hasOwnProperty.call(globalThis,b)||Object.defineProperty(globalThis,b,{value:{customEqualityTesters:[],matchers:Object.create(null),state:{assertionCalls:0,expectedAssertionsNumber:null,isExpectingAssertions:!1,numPassingAsserts:0,suppressedErrors:[]}}});let v=()=>globalThis[b].state;r.getState=v;let N=E=>{Object.assign(globalThis[b].state,E)};r.setState=N;let _=()=>globalThis[b].matchers;r.getMatchers=_;let m=(E,a,h)=>{for(let l of Object.keys(E)){let y=E[l];if(typeof y!="function")throw new TypeError(`expect.extend: \`${l}\` is not a valid matcher. Must be a function, is "${(0,c.getType)(y)}"`);if(Object.defineProperty(y,L,{value:a}),!a){class $ extends g.AsymmetricMatcher{constructor(S=!1,...R){super(R,S)}asymmetricMatch(S){let{pass:R}=y.call(this.getMatcherContext(),S,...this.sample);return this.inverse?!R:R}toString(){return`${this.inverse?"not.":""}${l}`}getExpectedType(){return"any"}toAsymmetricMatcher(){return`${this.toString()}<${this.sample.map(String).join(", ")}>`}}Object.defineProperty(h,l,{configurable:!0,enumerable:!0,value:(...C)=>new $(!1,...C),writable:!0}),Object.defineProperty(h.not,l,{configurable:!0,enumerable:!0,value:(...C)=>new $(!0,...C),writable:!0})}}Object.assign(globalThis[b].matchers,E)};r.setMatchers=m;let A=()=>globalThis[b].customEqualityTesters;r.getCustomEqualityTesters=A;let p=E=>{if(!Array.isArray(E))throw new TypeError(`expect.customEqualityTesters: Must be set to an array of Testers. Was given "${(0,c.getType)(E)}"`);globalThis[b].customEqualityTesters.push(...E)};r.addCustomEqualityTesters=p}),"./src/matchers.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=Ve(),g=je(),u=Be(),b=o("./src/print.ts");let L="Expected",v="Received",N="Expected value",_="Received value",m=a=>a!==!1,A=[c.iterableEquality,c.typeEquality,c.sparseArrayEquality,c.arrayBufferEquality],p={toBe(a,h){let l="toBe",y={comment:"Object.is equality",isNot:this.isNot,promise:this.promise},$=Object.is(a,h);return{actual:a,expected:h,message:$?()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(h)}`:()=>{let S=(0,g.getType)(h),R=null;return S!=="map"&&S!=="set"&&((0,c.equals)(a,h,[...this.customTesters,...A],!0)?R="toStrictEqual":(0,c.equals)(a,h,[...this.customTesters,c.iterableEquality])&&(R="toEqual")),(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(R===null?"":`${(0,u.DIM_COLOR)(`If it should pass with deep equality, replace "${l}" with "${R}"`)}
|
||||
|
||||
`)+(0,u.printDiffOrStringify)(h,a,L,v,m(this.expand))},name:l,pass:$}},toBeCloseTo(a,h,l=2){let y="toBeCloseTo",$=arguments.length===3?"precision":void 0,C=this.isNot,S={isNot:C,promise:this.promise,secondArgument:$,secondArgumentColor:T=>T};if(typeof h!="number")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(y,void 0,void 0,S),`${(0,u.EXPECTED_COLOR)("expected")} value must be a number`,(0,u.printWithType)("Expected",h,u.printExpected)));if(typeof a!="number")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(y,void 0,void 0,S),`${(0,u.RECEIVED_COLOR)("received")} value must be a number`,(0,u.printWithType)("Received",a,u.printReceived)));let R=!1,I=0,j=0;return a===Number.POSITIVE_INFINITY&&h===Number.POSITIVE_INFINITY||a===Number.NEGATIVE_INFINITY&&h===Number.NEGATIVE_INFINITY?R=!0:(I=Math.pow(10,-l)/2,j=Math.abs(h-a),R=j<I),{message:R?()=>(0,u.matcherHint)(y,void 0,void 0,S)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(h)}
|
||||
`+(j===0?"":`Received: ${(0,u.printReceived)(a)}
|
||||
|
||||
${(0,b.printCloseTo)(j,I,l,C)}`):()=>(0,u.matcherHint)(y,void 0,void 0,S)+`
|
||||
|
||||
Expected: ${(0,u.printExpected)(h)}
|
||||
Received: ${(0,u.printReceived)(a)}
|
||||
|
||||
`+(0,b.printCloseTo)(j,I,l,C),pass:R}},toBeDefined(a,h){let l="toBeDefined",y={isNot:this.isNot,promise:this.promise};return(0,u.ensureNoExpected)(h,l,y),{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:a!==void 0}},toBeFalsy(a,h){let l="toBeFalsy",y={isNot:this.isNot,promise:this.promise};return(0,u.ensureNoExpected)(h,l,y),{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:!a}},toBeGreaterThan(a,h){let l="toBeGreaterThan",y=this.isNot,$={isNot:y,promise:this.promise};(0,u.ensureNumbers)(a,h,l,$);let C=a>h;return{message:()=>(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
Expected:${y?" not":""} > ${(0,u.printExpected)(h)}
|
||||
Received:${y?" ":""} ${(0,u.printReceived)(a)}`,pass:C}},toBeGreaterThanOrEqual(a,h){let l="toBeGreaterThanOrEqual",y=this.isNot,$={isNot:y,promise:this.promise};(0,u.ensureNumbers)(a,h,l,$);let C=a>=h;return{message:()=>(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
Expected:${y?" not":""} >= ${(0,u.printExpected)(h)}
|
||||
Received:${y?" ":""} ${(0,u.printReceived)(a)}`,pass:C}},toBeInstanceOf(a,h){let l="toBeInstanceOf",y={isNot:this.isNot,promise:this.promise};if(typeof h!="function")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,y),`${(0,u.EXPECTED_COLOR)("expected")} value must be a function`,(0,u.printWithType)("Expected",h,u.printExpected)));let $=a instanceof h;return{message:$?()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(0,b.printExpectedConstructorNameNot)("Expected constructor",h)+(typeof a.constructor=="function"&&a.constructor!==h?(0,b.printReceivedConstructorNameNot)("Received constructor",a.constructor,h):""):()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(0,b.printExpectedConstructorName)("Expected constructor",h)+((0,g.isPrimitive)(a)||Object.getPrototypeOf(a)===null?`
|
||||
Received value has no prototype
|
||||
Received value: ${(0,u.printReceived)(a)}`:typeof a.constructor=="function"?(0,b.printReceivedConstructorName)("Received constructor",a.constructor):`
|
||||
Received value: ${(0,u.printReceived)(a)}`),pass:$}},toBeLessThan(a,h){let l="toBeLessThan",y=this.isNot,$={isNot:y,promise:this.promise};(0,u.ensureNumbers)(a,h,l,$);let C=a<h;return{message:()=>(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
Expected:${y?" not":""} < ${(0,u.printExpected)(h)}
|
||||
Received:${y?" ":""} ${(0,u.printReceived)(a)}`,pass:C}},toBeLessThanOrEqual(a,h){let l="toBeLessThanOrEqual",y=this.isNot,$={isNot:y,promise:this.promise};(0,u.ensureNumbers)(a,h,l,$);let C=a<=h;return{message:()=>(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
Expected:${y?" not":""} <= ${(0,u.printExpected)(h)}
|
||||
Received:${y?" ":""} ${(0,u.printReceived)(a)}`,pass:C}},toBeNaN(a,h){let l="toBeNaN",y={isNot:this.isNot,promise:this.promise};(0,u.ensureNoExpected)(h,l,y);let $=Number.isNaN(a);return{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:$}},toBeNull(a,h){let l="toBeNull",y={isNot:this.isNot,promise:this.promise};return(0,u.ensureNoExpected)(h,l,y),{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:a===null}},toBeTruthy(a,h){let l="toBeTruthy",y={isNot:this.isNot,promise:this.promise};return(0,u.ensureNoExpected)(h,l,y),{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:!!a}},toBeUndefined(a,h){let l="toBeUndefined",y={isNot:this.isNot,promise:this.promise};return(0,u.ensureNoExpected)(h,l,y),{message:()=>(0,u.matcherHint)(l,void 0,"",y)+`
|
||||
|
||||
Received: ${(0,u.printReceived)(a)}`,pass:a===void 0}},toContain(a,h){let l="toContain",y=this.isNot,$={comment:"indexOf",isNot:y,promise:this.promise};if(a==null)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,$),`${(0,u.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,u.printWithType)("Received",a,u.printReceived)));if(typeof a=="string"){let j=`${(0,u.EXPECTED_COLOR)("expected")} value must be a string if ${(0,u.RECEIVED_COLOR)("received")} value is a string`;if(typeof h!="string")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(l,a,String(h),$),j,(0,u.printWithType)("Expected",h,u.printExpected)+`
|
||||
`+(0,u.printWithType)("Received",a,u.printReceived)));let P=a.indexOf(String(h));return{message:()=>{let d=`Expected ${typeof h=="string"?"substring":"value"}`,w="Received string",x=(0,u.getLabelPrinter)(d,w);return(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
${x(d)}${y?"not ":""}${(0,u.printExpected)(h)}
|
||||
${x(w)}${y?" ":""}${y?(0,b.printReceivedStringContainExpectedSubstring)(a,P,String(h).length):(0,u.printReceived)(a)}`},pass:P!==-1}}let C=[...a],S=C.indexOf(h);return{message:()=>{let j="Expected value",P=`Received ${(0,g.getType)(a)}`,T=(0,u.getLabelPrinter)(j,P);return(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
${T(j)}${y?"not ":""}${(0,u.printExpected)(h)}
|
||||
${T(P)}${y?" ":""}${y&&Array.isArray(a)?(0,b.printReceivedArrayContainExpectedItem)(a,S):(0,u.printReceived)(a)}`+(!y&&C.some(f=>(0,c.equals)(f,h,[...this.customTesters,c.iterableEquality]))?`
|
||||
|
||||
${u.SUGGEST_TO_CONTAIN_EQUAL}`:"")},pass:S!==-1}},toContainEqual(a,h){let l="toContainEqual",y=this.isNot,$={comment:"deep equality",isNot:y,promise:this.promise};if(a==null)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,$),`${(0,u.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,u.printWithType)("Received",a,u.printReceived)));let C=[...a].findIndex(I=>(0,c.equals)(I,h,[...this.customTesters,c.iterableEquality]));return{message:()=>{let I="Expected value",j=`Received ${(0,g.getType)(a)}`,P=(0,u.getLabelPrinter)(I,j);return(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
${P(I)}${y?"not ":""}${(0,u.printExpected)(h)}
|
||||
${P(j)}${y?" ":""}${y&&Array.isArray(a)?(0,b.printReceivedArrayContainExpectedItem)(a,C):(0,u.printReceived)(a)}`},pass:C!==-1}},toEqual(a,h){let l="toEqual",y={comment:"deep equality",isNot:this.isNot,promise:this.promise},$=(0,c.equals)(a,h,[...this.customTesters,c.iterableEquality]);return{actual:a,expected:h,message:$?()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(h)}
|
||||
`+((0,u.stringify)(h)===(0,u.stringify)(a)?"":`Received: ${(0,u.printReceived)(a)}`):()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(0,u.printDiffOrStringify)(h,a,L,v,m(this.expand)),name:l,pass:$}},toHaveLength(a,h){let l="toHaveLength",y=this.isNot,$={isNot:y,promise:this.promise};if(typeof(a==null?void 0:a.length)!="number")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,$),`${(0,u.RECEIVED_COLOR)("received")} value must have a length property whose value must be a number`,(0,u.printWithType)("Received",a,u.printReceived)));(0,u.ensureExpectedIsNonNegativeInteger)(h,l,$);let C=a.length===h;return{message:()=>{let R="Expected length",I="Received length",j=`Received ${(0,g.getType)(a)}`,P=(0,u.getLabelPrinter)(R,I,j);return(0,u.matcherHint)(l,void 0,void 0,$)+`
|
||||
|
||||
${P(R)}${y?"not ":""}${(0,u.printExpected)(h)}
|
||||
`+(y?"":`${P(I)}${(0,u.printReceived)(a.length)}
|
||||
`)+`${P(j)}${y?" ":""}${(0,u.printReceived)(a)}`},pass:C}},toHaveProperty(a,h,l){let y="toHaveProperty",$="path",C=arguments.length===3,S={isNot:this.isNot,promise:this.promise,secondArgument:C?"value":""};if(a==null)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(y,void 0,$,S),`${(0,u.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,u.printWithType)("Received",a,u.printReceived)));let R=(0,g.getType)(h);if(R!=="string"&&R!=="array")throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(y,void 0,$,S),`${(0,u.EXPECTED_COLOR)("expected")} path must be a string or array`,(0,u.printWithType)("Expected",h,u.printExpected)));let I=typeof h=="string"?(0,c.pathAsArray)(h).length:h.length;if(R==="array"&&I===0)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(y,void 0,$,S),`${(0,u.EXPECTED_COLOR)("expected")} path must not be an empty array`,(0,u.printWithType)("Expected",h,u.printExpected)));let j=(0,c.getPath)(a,h),{lastTraversedObject:P,endPropIsDefined:T,hasEndProp:f,value:d}=j,w=j.traversedPath,x=w.length===I,k=x?j.value:P,G=C&&T?(0,c.equals)(d,l,[...this.customTesters,c.iterableEquality]):!!f;return{message:G?()=>(0,u.matcherHint)(y,void 0,$,S)+`
|
||||
|
||||
`+(C?`Expected path: ${(0,u.printExpected)(h)}
|
||||
|
||||
Expected value: not ${(0,u.printExpected)(l)}${(0,u.stringify)(l)===(0,u.stringify)(k)?"":`
|
||||
Received value: ${(0,u.printReceived)(k)}`}`:`Expected path: not ${(0,u.printExpected)(h)}
|
||||
|
||||
Received value: ${(0,u.printReceived)(k)}`):()=>(0,u.matcherHint)(y,void 0,$,S)+`
|
||||
|
||||
Expected path: ${(0,u.printExpected)(h)}
|
||||
`+(x?`
|
||||
${(0,u.printDiffOrStringify)(l,k,N,_,m(this.expand))}`:`Received path: ${(0,u.printReceived)(R==="array"||w.length===0?w:w.join("."))}
|
||||
|
||||
${C?`Expected value: ${(0,u.printExpected)(l)}
|
||||
`:""}Received value: ${(0,u.printReceived)(k)}`),pass:G}},toMatch(a,h){let l="toMatch",y={isNot:this.isNot,promise:this.promise};if(typeof a!="string")throw new TypeError((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,y),`${(0,u.RECEIVED_COLOR)("received")} value must be a string`,(0,u.printWithType)("Received",a,u.printReceived)));if(typeof h!="string"&&!(h&&typeof h.test=="function"))throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,y),`${(0,u.EXPECTED_COLOR)("expected")} value must be a string or regular expression`,(0,u.printWithType)("Expected",h,u.printExpected)));let $=typeof h=="string"?a.includes(h):new RegExp(h).test(a);return{message:$?()=>typeof h=="string"?(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected substring: not ${(0,u.printExpected)(h)}
|
||||
Received string: ${(0,b.printReceivedStringContainExpectedSubstring)(a,a.indexOf(h),h.length)}`:(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected pattern: not ${(0,u.printExpected)(h)}
|
||||
Received string: ${(0,b.printReceivedStringContainExpectedResult)(a,typeof h.exec=="function"?h.exec(a):null)}`:()=>{let S=`Expected ${typeof h=="string"?"substring":"pattern"}`,R="Received string",I=(0,u.getLabelPrinter)(S,R);return(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
${I(S)}${(0,u.printExpected)(h)}
|
||||
${I(R)}${(0,u.printReceived)(a)}`},pass:$}},toMatchObject(a,h){let l="toMatchObject",y={isNot:this.isNot,promise:this.promise};if(typeof a!="object"||a===null)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,y),`${(0,u.RECEIVED_COLOR)("received")} value must be a non-null object`,(0,u.printWithType)("Received",a,u.printReceived)));if(typeof h!="object"||h===null)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(l,void 0,void 0,y),`${(0,u.EXPECTED_COLOR)("expected")} value must be a non-null object`,(0,u.printWithType)("Expected",h,u.printExpected)));let $=(0,c.equals)(a,h,[...this.customTesters,c.iterableEquality,c.subsetEquality]);return{message:$?()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(h)}`+((0,u.stringify)(h)===(0,u.stringify)(a)?"":`
|
||||
Received: ${(0,u.printReceived)(a)}`):()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(0,u.printDiffOrStringify)(h,(0,c.getObjectSubset)(a,h,this.customTesters),L,v,m(this.expand)),pass:$}},toStrictEqual(a,h){let l="toStrictEqual",y={comment:"deep equality",isNot:this.isNot,promise:this.promise},$=(0,c.equals)(a,h,[...this.customTesters,...A],!0);return{actual:a,expected:h,message:$?()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(h)}
|
||||
`+((0,u.stringify)(h)===(0,u.stringify)(a)?"":`Received: ${(0,u.printReceived)(a)}`):()=>(0,u.matcherHint)(l,void 0,void 0,y)+`
|
||||
|
||||
`+(0,u.printDiffOrStringify)(h,a,L,v,m(this.expand)),name:l,pass:$}}};var E=r.default=p}),"./src/print.ts":((s,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.printReceivedStringContainExpectedSubstring=r.printReceivedStringContainExpectedResult=r.printReceivedConstructorNameNot=r.printReceivedConstructorName=r.printReceivedArrayContainExpectedItem=r.printExpectedConstructorNameNot=r.printExpectedConstructorName=r.printCloseTo=void 0;var o=Be();let c=p=>p.replaceAll(/"|\\/g,"\\$&"),g=(p,E,a)=>(0,o.RECEIVED_COLOR)(`"${c(p.slice(0,E))}${(0,o.INVERTED_COLOR)(c(p.slice(E,E+a)))}${c(p.slice(E+a))}"`);r.printReceivedStringContainExpectedSubstring=g;let u=(p,E)=>E===null?(0,o.printReceived)(p):g(p,E.index,E[0].length);r.printReceivedStringContainExpectedResult=u;let b=(p,E)=>(0,o.RECEIVED_COLOR)(`[${p.map((a,h)=>{let l=(0,o.stringify)(a);return h===E?(0,o.INVERTED_COLOR)(l):l}).join(", ")}]`);r.printReceivedArrayContainExpectedItem=b;let L=(p,E,a,h)=>{let l=(0,o.stringify)(p),y=l.includes("e")?E.toExponential(0):0<=a&&a<20?E.toFixed(a+1):(0,o.stringify)(E);return`Expected precision: ${h?" ":""} ${(0,o.stringify)(a)}
|
||||
Expected difference: ${h?"not ":""}< ${(0,o.EXPECTED_COLOR)(y)}
|
||||
Received difference: ${h?" ":""} ${(0,o.RECEIVED_COLOR)(l)}`};r.printCloseTo=L;let v=(p,E)=>`${A(p,E,!1,!0)}
|
||||
`;r.printExpectedConstructorName=v;let N=(p,E)=>`${A(p,E,!0,!0)}
|
||||
`;r.printExpectedConstructorNameNot=N;let _=(p,E)=>`${A(p,E,!1,!1)}
|
||||
`;r.printReceivedConstructorName=_;let m=(p,E,a)=>typeof a.name=="string"&&a.name.length>0&&typeof E.name=="string"&&E.name.length>0?`${A(p,E,!0,!1)} ${Object.getPrototypeOf(E)===a?"extends":"extends \u2026 extends"} ${(0,o.EXPECTED_COLOR)(a.name)}
|
||||
`:`${A(p,E,!1,!1)}
|
||||
`;r.printReceivedConstructorNameNot=m;let A=(p,E,a,h)=>typeof E.name=="string"?E.name.length===0?`${p} name is an empty string`:`${p}: ${a?h?"not ":" ":""}${h?(0,o.EXPECTED_COLOR)(E.name):(0,o.RECEIVED_COLOR)(E.name)}`:`${p} name is not a string`}),"./src/spyMatchers.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=Ve(),g=je(),u=Be(),b=o("./src/jestMatchersObject.ts");let L=M=>M!==!1,v=3,N="called with 0 arguments",_=M=>M.length===0?N:M.map(F=>(0,u.printExpected)(F)).join(", "),m=(M,F)=>M.length===0?N:M.map((Q,O)=>Array.isArray(F)&&O<F.length&&p(F[O],Q)?A(Q):(0,u.printReceived)(Q)).join(", "),A=M=>(0,u.DIM_COLOR)((0,u.stringify)(M)),p=(M,F)=>(0,c.equals)(M,F,[...(0,b.getCustomEqualityTesters)(),c.iterableEquality]),E=(M,F)=>F.length===M.length&&p(M,F),a=(M,F)=>F.type==="return"&&p(M,F.value),h=M=>M.reduce((F,Q)=>Q.type==="return"?F+1:F,0),l=(M,F)=>`
|
||||
Number of returns: ${(0,u.printReceived)(M)}${F===M?"":`
|
||||
Number of calls: ${(0,u.printReceived)(F)}`}`,y=M=>{let F=M.indexOf(":"),Q=M.slice(F);return(O,K)=>(K?`->${" ".repeat(Math.max(0,F-2-O.length))}`:" ".repeat(Math.max(F-O.length)))+O+Q},$=(M,F,Q,O)=>{if(F.length===0)return"";let K="Received: ";if(Q)return`${K+m(F[0],M)}
|
||||
`;let Z=y(K);return`Received
|
||||
${F.reduce((H,[B,D])=>`${H+Z(String(B+1),B===O)+m(D,M)}
|
||||
`,"")}`},C=(M,F,Q,O,K)=>{let Z=`Expected: ${_(M)}
|
||||
`;if(F.length===0)return Z;let H="Received: ";if(O&&(K===0||K===void 0)){let D=F[0][1];if(I(M,D)){let U=[(0,u.EXPECTED_COLOR)("- Expected"),(0,u.RECEIVED_COLOR)("+ Received"),""],V=Math.max(M.length,D.length);for(let te=0;te<V;te+=1){if(te<M.length&&te<D.length){if(p(M[te],D[te])){U.push(` ${A(D[te])},`);continue}if(j(M[te],D[te])){let ne=(0,u.diff)(M[te],D[te],{expand:Q});if(typeof ne=="string"&&ne.includes("- Expected")&&ne.includes("+ Received")){U.push(`${ne.split(`
|
||||
`).slice(3).join(`
|
||||
`)},`);continue}}}te<M.length&&U.push(`${(0,u.EXPECTED_COLOR)(`- ${(0,u.stringify)(M[te])}`)},`),te<D.length&&U.push(`${(0,u.RECEIVED_COLOR)(`+ ${(0,u.stringify)(D[te])}`)},`)}return`${U.join(`
|
||||
`)}
|
||||
`}return`${Z+H+m(D,M)}
|
||||
`}let B=y(H);return Z+`Received
|
||||
`+F.reduce((D,[U,V])=>{let te=B(String(U+1),U===K);return`${D+((U===K||K===void 0)&&I(M,V)?te.replace(": ",`
|
||||
`)+R(M,V,Q):te+m(V,M))}
|
||||
`},"")},S="Received".replaceAll(/\w/g," "),R=(M,F,Q)=>F.map((O,K)=>{if(K<M.length){if(p(M[K],O))return`${S} ${A(O)},`;if(j(M[K],O)){let Z=(0,u.diff)(M[K],O,{expand:Q});if(typeof Z=="string"&&Z.includes("- Expected")&&Z.includes("+ Received"))return`${Z.split(`
|
||||
`).slice(3).map(H=>S+H).join(`
|
||||
`)},`}}return`${S+(K<M.length?` ${(0,u.printReceived)(O)}`:(0,u.RECEIVED_COLOR)(`+ ${(0,u.stringify)(O)}`))},`}).join(`
|
||||
`),I=(M,F)=>M.some((Q,O)=>O<F.length&&j(Q,F[O])),j=(M,F)=>{let Q=(0,g.getType)(M),O=(0,g.getType)(F);return!(Q!==O||(0,g.isPrimitive)(M)||Q==="date"||Q==="function"||Q==="regexp"||M instanceof Error&&F instanceof Error||Q==="object"&&typeof M.asymmetricMatch=="function"||O==="object"&&typeof F.asymmetricMatch=="function")},P=(M,F)=>M.type==="throw"?"function call threw an error":M.type==="incomplete"?"function call has not returned yet":p(F,M.value)?A(M.value):(0,u.printReceived)(M.value),T=(M,F,Q,O,K)=>{if(Q.length===0)return"";if(O&&(K===0||K===void 0))return`${M+P(Q[0][1],F)}
|
||||
`;let Z=y(M);return M.replace(":","").trim()+`
|
||||
`+Q.reduce((H,[B,D])=>`${H+Z(String(B+1),B===K)+P(D,F)}
|
||||
`,"")},f=()=>function(M,F){let O={isNot:this.isNot,promise:this.promise};(0,u.ensureNoExpected)(F,"toHaveBeenCalled",O),X(M,"toHaveBeenCalled","",O);let K=ie(M),Z=K?"spy":M.getMockName(),H=K?M.calls.count():M.mock.calls.length,B=K?M.calls.all().map(V=>V.args):M.mock.calls,D=H>0;return{message:D?()=>(0,u.matcherHint)("toHaveBeenCalled",Z,"",O)+`
|
||||
|
||||
Expected number of calls: ${(0,u.printExpected)(0)}
|
||||
Received number of calls: ${(0,u.printReceived)(H)}
|
||||
|
||||
`+B.reduce((V,te,ne)=>(V.length<v&&V.push(`${ne+1}: ${m(te)}`),V),[]).join(`
|
||||
`):()=>(0,u.matcherHint)("toHaveBeenCalled",Z,"",O)+`
|
||||
|
||||
Expected number of calls: >= ${(0,u.printExpected)(1)}
|
||||
Received number of calls: ${(0,u.printReceived)(H)}`,pass:D}},d=()=>function(M,F){let O={isNot:this.isNot,promise:this.promise};(0,u.ensureNoExpected)(F,"toHaveReturned",O),Y(M,"toHaveReturned","",O);let K=M.getMockName(),Z=M.mock.results.reduce((D,U)=>U.type==="return"?D+1:D,0),H=Z>0;return{message:H?()=>(0,u.matcherHint)("toHaveReturned",K,"",O)+`
|
||||
|
||||
Expected number of returns: ${(0,u.printExpected)(0)}
|
||||
Received number of returns: ${(0,u.printReceived)(Z)}
|
||||
|
||||
`+M.mock.results.reduce((D,U,V)=>(U.type==="return"&&D.length<v&&D.push(`${V+1}: ${(0,u.printReceived)(U.value)}`),D),[]).join(`
|
||||
`)+(M.mock.calls.length===Z?"":`
|
||||
|
||||
Received number of calls: ${(0,u.printReceived)(M.mock.calls.length)}`):()=>(0,u.matcherHint)("toHaveReturned",K,"",O)+`
|
||||
|
||||
Expected number of returns: >= ${(0,u.printExpected)(1)}
|
||||
Received number of returns: ${(0,u.printReceived)(Z)}`+(M.mock.calls.length===Z?"":`
|
||||
Received number of calls: ${(0,u.printReceived)(M.mock.calls.length)}`),pass:H}},w=()=>function(M,F){let Q="expected",O={isNot:this.isNot,promise:this.promise};(0,u.ensureExpectedIsNonNegativeInteger)(F,"toHaveBeenCalledTimes",O),X(M,"toHaveBeenCalledTimes",Q,O);let K=ie(M),Z=K?"spy":M.getMockName(),H=K?M.calls.count():M.mock.calls.length,B=H===F;return{message:B?()=>(0,u.matcherHint)("toHaveBeenCalledTimes",Z,Q,O)+`
|
||||
|
||||
Expected number of calls: not ${(0,u.printExpected)(F)}`:()=>(0,u.matcherHint)("toHaveBeenCalledTimes",Z,Q,O)+`
|
||||
|
||||
Expected number of calls: ${(0,u.printExpected)(F)}
|
||||
Received number of calls: ${(0,u.printReceived)(H)}`,pass:B}},x=()=>function(M,F){let Q="expected",O={isNot:this.isNot,promise:this.promise};(0,u.ensureExpectedIsNonNegativeInteger)(F,"toHaveReturnedTimes",O),Y(M,"toHaveReturnedTimes",Q,O);let K=M.getMockName(),Z=M.mock.results.reduce((D,U)=>U.type==="return"?D+1:D,0),H=Z===F;return{message:H?()=>(0,u.matcherHint)("toHaveReturnedTimes",K,Q,O)+`
|
||||
|
||||
Expected number of returns: not ${(0,u.printExpected)(F)}`+(M.mock.calls.length===Z?"":`
|
||||
|
||||
Received number of calls: ${(0,u.printReceived)(M.mock.calls.length)}`):()=>(0,u.matcherHint)("toHaveReturnedTimes",K,Q,O)+`
|
||||
|
||||
Expected number of returns: ${(0,u.printExpected)(F)}
|
||||
Received number of returns: ${(0,u.printReceived)(Z)}`+(M.mock.calls.length===Z?"":`
|
||||
Received number of calls: ${(0,u.printReceived)(M.mock.calls.length)}`),pass:H}},k=()=>function(M,...F){let Q="...expected",O={isNot:this.isNot,promise:this.promise};X(M,"toHaveBeenCalledWith",Q,O);let K=ie(M),Z=K?"spy":M.getMockName(),H=K?M.calls.all().map(U=>U.args):M.mock.calls,B=H.some(U=>E(F,U));return{message:B?()=>{let U=[],V=0;for(;V<H.length&&U.length<v;)E(F,H[V])&&U.push([V,H[V]]),V+=1;return(0,u.matcherHint)("toHaveBeenCalledWith",Z,Q,O)+`
|
||||
|
||||
Expected: not ${_(F)}
|
||||
`+(H.length===1&&(0,u.stringify)(H[0])===(0,u.stringify)(F)?"":$(F,U,H.length===1))+`
|
||||
Number of calls: ${(0,u.printReceived)(H.length)}`}:()=>{let U=[],V=0;for(;V<H.length&&U.length<v;)U.push([V,H[V]]),V+=1;return(0,u.matcherHint)("toHaveBeenCalledWith",Z,Q,O)+`
|
||||
|
||||
`+C(F,U,L(this.expand),H.length===1)+`
|
||||
Number of calls: ${(0,u.printReceived)(H.length)}`},pass:B}},G=()=>function(M,F){let Q="expected",O={isNot:this.isNot,promise:this.promise};Y(M,"toHaveReturnedWith",Q,O);let K=M.getMockName(),{calls:Z,results:H}=M.mock,B=H.some(U=>a(F,U));return{message:B?()=>{let U=[],V=0;for(;V<H.length&&U.length<v;)a(F,H[V])&&U.push([V,H[V]]),V+=1;return(0,u.matcherHint)("toHaveReturnedWith",K,Q,O)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(F)}
|
||||
`+(H.length===1&&H[0].type==="return"&&(0,u.stringify)(H[0].value)===(0,u.stringify)(F)?"":T("Received: ",F,U,H.length===1))+l(h(H),Z.length)}:()=>{let U=[],V=0;for(;V<H.length&&U.length<v;)U.push([V,H[V]]),V+=1;return(0,u.matcherHint)("toHaveReturnedWith",K,Q,O)+`
|
||||
|
||||
Expected: ${(0,u.printExpected)(F)}
|
||||
`+T("Received: ",F,U,H.length===1)+l(h(H),Z.length)},pass:B}},W=()=>function(M,...F){let Q="...expected",O={isNot:this.isNot,promise:this.promise};X(M,"toHaveBeenLastCalledWith",Q,O);let K=ie(M),Z=K?"spy":M.getMockName(),H=K?M.calls.all().map(V=>V.args):M.mock.calls,B=H.length-1,D=B>=0&&E(F,H[B]);return{message:D?()=>{let V=[];return B>0&&V.push([B-1,H[B-1]]),V.push([B,H[B]]),(0,u.matcherHint)("toHaveBeenLastCalledWith",Z,Q,O)+`
|
||||
|
||||
Expected: not ${_(F)}
|
||||
`+(H.length===1&&(0,u.stringify)(H[0])===(0,u.stringify)(F)?"":$(F,V,H.length===1,B))+`
|
||||
Number of calls: ${(0,u.printReceived)(H.length)}`}:()=>{let V=[];if(B>=0){if(B>0){let te=B-1;for(;te>=0&&!E(F,H[te]);)te-=1;te<0&&(te=B-1),V.push([te,H[te]])}V.push([B,H[B]])}return(0,u.matcherHint)("toHaveBeenLastCalledWith",Z,Q,O)+`
|
||||
|
||||
`+C(F,V,L(this.expand),H.length===1,B)+`
|
||||
Number of calls: ${(0,u.printReceived)(H.length)}`},pass:D}},se=()=>function(M,F){let Q="expected",O={isNot:this.isNot,promise:this.promise};Y(M,"toHaveLastReturnedWith",Q,O);let K=M.getMockName(),{calls:Z,results:H}=M.mock,B=H.length-1,D=B>=0&&a(F,H[B]);return{message:D?()=>{let V=[];return B>0&&V.push([B-1,H[B-1]]),V.push([B,H[B]]),(0,u.matcherHint)("toHaveLastReturnedWith",K,Q,O)+`
|
||||
|
||||
Expected: not ${(0,u.printExpected)(F)}
|
||||
`+(H.length===1&&H[0].type==="return"&&(0,u.stringify)(H[0].value)===(0,u.stringify)(F)?"":T("Received: ",F,V,H.length===1,B))+l(h(H),Z.length)}:()=>{let V=[];if(B>=0){if(B>0){let te=B-1;for(;te>=0&&!a(F,H[te]);)te-=1;te<0&&(te=B-1),V.push([te,H[te]])}V.push([B,H[B]])}return(0,u.matcherHint)("toHaveLastReturnedWith",K,Q,O)+`
|
||||
|
||||
Expected: ${(0,u.printExpected)(F)}
|
||||
`+T("Received: ",F,V,H.length===1,B)+l(h(H),Z.length)},pass:D}},ue=()=>function(M,F,...Q){let K={expectedColor:ne=>ne,isNot:this.isNot,promise:this.promise,secondArgument:"...expected"};if(X(M,"toHaveBeenNthCalledWith","n",K),!Number.isSafeInteger(F)||F<1)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)("toHaveBeenNthCalledWith",void 0,"n",K),"n must be a positive integer",(0,u.printWithType)("n",F,u.stringify)));let Z=ie(M),H=Z?"spy":M.getMockName(),B=Z?M.calls.all().map(ne=>ne.args):M.mock.calls,D=B.length,U=F-1,V=U<D&&E(Q,B[U]);return{message:V?()=>{let ne=[];return U-1>=0&&ne.push([U-1,B[U-1]]),ne.push([U,B[U]]),U+1<D&&ne.push([U+1,B[U+1]]),(0,u.matcherHint)("toHaveBeenNthCalledWith",H,"n",K)+`
|
||||
|
||||
n: ${F}
|
||||
Expected: not ${_(Q)}
|
||||
`+(B.length===1&&(0,u.stringify)(B[0])===(0,u.stringify)(Q)?"":$(Q,ne,B.length===1,U))+`
|
||||
Number of calls: ${(0,u.printReceived)(B.length)}`}:()=>{let ne=[];if(U<D){if(U-1>=0){let re=U-1;for(;re>=0&&!E(Q,B[re]);)re-=1;re<0&&(re=U-1),ne.push([re,B[re]])}if(ne.push([U,B[U]]),U+1<D){let re=U+1;for(;re<D&&!E(Q,B[re]);)re+=1;re>=D&&(re=U+1),ne.push([re,B[re]])}}else if(D>0){let re=D-1;for(;re>=0&&!E(Q,B[re]);)re-=1;re<0&&(re=D-1),ne.push([re,B[re]])}return(0,u.matcherHint)("toHaveBeenNthCalledWith",H,"n",K)+`
|
||||
|
||||
n: ${F}
|
||||
`+C(Q,ne,L(this.expand),B.length===1,U)+`
|
||||
Number of calls: ${(0,u.printReceived)(B.length)}`},pass:V}},ee=()=>function(M,F,Q){let K={expectedColor:ne=>ne,isNot:this.isNot,promise:this.promise,secondArgument:"expected"};if(Y(M,"toHaveNthReturnedWith","n",K),!Number.isSafeInteger(F)||F<1)throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)("toHaveNthReturnedWith",void 0,"n",K),"n must be a positive integer",(0,u.printWithType)("n",F,u.stringify)));let Z=M.getMockName(),{calls:H,results:B}=M.mock,D=B.length,U=F-1,V=U<D&&a(Q,B[U]);return{message:V?()=>{let ne=[];return U-1>=0&&ne.push([U-1,B[U-1]]),ne.push([U,B[U]]),U+1<D&&ne.push([U+1,B[U+1]]),(0,u.matcherHint)("toHaveNthReturnedWith",Z,"n",K)+`
|
||||
|
||||
n: ${F}
|
||||
Expected: not ${(0,u.printExpected)(Q)}
|
||||
`+(B.length===1&&B[0].type==="return"&&(0,u.stringify)(B[0].value)===(0,u.stringify)(Q)?"":T("Received: ",Q,ne,B.length===1,U))+l(h(B),H.length)}:()=>{let ne=[];if(U<D){if(U-1>=0){let re=U-1;for(;re>=0&&!a(Q,B[re]);)re-=1;re<0&&(re=U-1),ne.push([re,B[re]])}if(ne.push([U,B[U]]),U+1<D){let re=U+1;for(;re<D&&!a(Q,B[re]);)re+=1;re>=D&&(re=U+1),ne.push([re,B[re]])}}else if(D>0){let re=D-1;for(;re>=0&&!a(Q,B[re]);)re-=1;re<0&&(re=D-1),ne.push([re,B[re]])}return(0,u.matcherHint)("toHaveNthReturnedWith",Z,"n",K)+`
|
||||
|
||||
n: ${F}
|
||||
Expected: ${(0,u.printExpected)(Q)}
|
||||
`+T("Received: ",Q,ne,B.length===1,U)+l(h(B),H.length)},pass:V}},q={toHaveBeenCalled:f(),toHaveBeenCalledTimes:w(),toHaveBeenCalledWith:k(),toHaveBeenLastCalledWith:W(),toHaveBeenNthCalledWith:ue(),toHaveLastReturnedWith:se(),toHaveNthReturnedWith:ee(),toHaveReturned:d(),toHaveReturnedTimes:x(),toHaveReturnedWith:G()},z=M=>M!=null&&M._isMockFunction===!0,ie=M=>M!=null&&M.calls!=null&&typeof M.calls.all=="function"&&typeof M.calls.count=="function",X=(M,F,Q,O)=>{if(!z(M)&&!ie(M))throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(F,void 0,Q,O),`${(0,u.RECEIVED_COLOR)("received")} value must be a mock or spy function`,(0,u.printWithType)("Received",M,u.printReceived)))},Y=(M,F,Q,O)=>{if(!z(M))throw new Error((0,u.matcherErrorMessage)((0,u.matcherHint)(F,void 0,Q,O),`${(0,u.RECEIVED_COLOR)("received")} value must be a mock function`,(0,u.printWithType)("Received",M,u.printReceived)))};var J=r.default=q}),"./src/toThrowMatchers.ts":((s,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.createMatcher=void 0;var c=Ve(),g=Be(),u=gu(),b=o("./src/print.ts");let L="Received function did not throw",v=P=>{let T=P!=null&&typeof P.message=="string";return T&&typeof P.name=="string"&&typeof P.stack=="string"?{hasMessage:T,isError:!0,message:P.message,value:P}:{hasMessage:T,isError:!1,message:T?P.message:String(P),value:P}},N=(P,T)=>function(f,d){let w={isNot:this.isNot,promise:this.promise},x=null;if(T&&(0,c.isError)(f))x=v(f);else if(typeof f=="function")try{f()}catch(k){x=v(k)}else if(!T){let k=d===void 0?"":"expected";throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(P,void 0,k,w),`${(0,g.RECEIVED_COLOR)("received")} value must be a function`,(0,g.printWithType)("Received",f,g.printReceived)))}if(d===void 0)return h(P,w,x);if(typeof d=="function")return E(P,w,x,d);if(typeof d=="string")return a(P,w,x,d);if(d!==null&&typeof d.test=="function")return m(P,w,x,d);if(d!==null&&typeof d.asymmetricMatch=="function")return A(P,w,x,d);if(d!==null&&typeof d=="object")return p(P,w,x,d);throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(P,void 0,void 0,w),`${(0,g.EXPECTED_COLOR)("expected")} value must be a string or regular expression or class or error`,(0,g.printWithType)("Expected",d,g.printExpected)))};r.createMatcher=N;let _={toThrow:N("toThrow")},m=(P,T,f,d)=>{let w=f!==null&&d.test(f.message);return{message:w?()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected pattern: not ",d)+(f!==null&&f.hasMessage?y("Received message: ",f,"message",d)+$(f):y("Received value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected pattern: ",d)+(f===null?`
|
||||
${L}`:f.hasMessage?y("Received message: ",f,"message")+$(f):y("Received value: ",f,"value")),pass:w}},A=(P,T,f,d)=>{let w=f!==null&&d.asymmetricMatch(f.value);return{message:w?()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected asymmetric matcher: not ",d)+`
|
||||
`+(f!==null&&f.hasMessage?y("Received name: ",f,"name")+y("Received message: ",f,"message")+$(f):y("Thrown value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected asymmetric matcher: ",d)+`
|
||||
`+(f===null?L:f.hasMessage?y("Received name: ",f,"name")+y("Received message: ",f,"message")+$(f):y("Thrown value: ",f,"value")),pass:w}},p=(P,T,f,d)=>{let w=C(d),x=f===null?null:C(f.value),k=(f==null?void 0:f.isError)&&d instanceof Error,G=d.constructor.name!==Error.name,W=f!==null&&f.message===d.message&&x===w&&(!k||!G||f.value instanceof d.constructor);return{message:W?()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l(`Expected ${I(d)}: not `,w)+(f!==null&&f.hasMessage?$(f):y("Received value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+(f===null?l(`Expected ${I(d)}: `,w)+`
|
||||
`+L:f.hasMessage?(0,g.printDiffOrStringify)(w,x,`Expected ${I(d)}`,`Received ${I(f.value)}`,!0)+`
|
||||
`+$(f):l(`Expected ${I(d)}: `,w)+y("Received value: ",f,"value")),pass:W}},E=(P,T,f,d)=>{let w=f!==null&&f.value instanceof d;return{message:w?()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+(0,b.printExpectedConstructorNameNot)("Expected constructor",d)+(f!==null&&f.value!=null&&typeof f.value.constructor=="function"&&f.value.constructor!==d?(0,b.printReceivedConstructorNameNot)("Received constructor",f.value.constructor,d):"")+`
|
||||
`+(f!==null&&f.hasMessage?y("Received message: ",f,"message")+$(f):y("Received value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+(0,b.printExpectedConstructorName)("Expected constructor",d)+(f===null?`
|
||||
${L}`:`${f.value!=null&&typeof f.value.constructor=="function"?(0,b.printReceivedConstructorName)("Received constructor",f.value.constructor):""}
|
||||
${f.hasMessage?y("Received message: ",f,"message")+$(f):y("Received value: ",f,"value")}`),pass:w}},a=(P,T,f,d)=>{let w=f!==null&&f.message.includes(d);return{message:w?()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected substring: not ",d)+(f!==null&&f.hasMessage?y("Received message: ",f,"message",d)+$(f):y("Received value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,void 0,T)+`
|
||||
|
||||
`+l("Expected substring: ",d)+(f===null?`
|
||||
${L}`:f.hasMessage?y("Received message: ",f,"message")+$(f):y("Received value: ",f,"value")),pass:w}},h=(P,T,f)=>{let d=f!==null;return{message:d?()=>(0,g.matcherHint)(P,void 0,"",T)+`
|
||||
|
||||
`+(f!==null&&f.hasMessage?y("Error name: ",f,"name")+y("Error message: ",f,"message")+$(f):y("Thrown value: ",f,"value")):()=>(0,g.matcherHint)(P,void 0,"",T)+`
|
||||
|
||||
`+L,pass:d}},l=(P,T)=>`${P+(0,g.printExpected)(T)}
|
||||
`,y=(P,T,f,d)=>{if(T===null)return"";if(f==="message"){let w=T.message;if(typeof d=="string"){let x=w.indexOf(d);if(x!==-1)return`${P+(0,b.printReceivedStringContainExpectedSubstring)(w,x,d.length)}
|
||||
`}else if(d instanceof RegExp)return`${P+(0,b.printReceivedStringContainExpectedResult)(w,typeof d.exec=="function"?d.exec(w):null)}
|
||||
`;return`${P+(0,g.printReceived)(w)}
|
||||
`}return f==="name"?T.isError?`${P+(0,g.printReceived)(T.value.name)}
|
||||
`:"":f==="value"?T.isError?"":`${P+(0,g.printReceived)(T.value)}
|
||||
`:""},$=P=>{if(P===null||!P.isError)return"";{let T={rootDir:process.cwd(),testMatch:[]},f={noStackTrace:!1};return P.value instanceof AggregateError?(0,u.formatExecError)(P.value,T,f):(0,u.formatStackTrace)((0,u.separateMessageFromStack)(P.value.stack).stack,T,f)}};function C(P){if(P.cause){let T=new WeakSet;return JSON.stringify(S(P),(f,d)=>{if(R(d)){if(T.has(d))return;T.add(d)}return typeof d=="bigint"||d===void 0?String(d):d})}return P.message}function S(P){if(!R(P))return P;let T={};for(let f of Object.getOwnPropertyNames(P).sort())if(!["stack","fileName","lineNumber"].includes(f)){if(f==="cause"){T[f]=S(P.cause);continue}T[f]=P[f]}return T}function R(P){return P!=null&&typeof P=="object"}function I(P){return P.cause===void 0?"message":"message and cause"}var j=r.default=_})},t={};function n(s){var r=t[s];if(r!==void 0)return r.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,n),o.exports}var i={};(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"AsymmetricMatcher",{enumerable:!0,get:function(){return g.AsymmetricMatcher}}),s.expect=s.default=s.JestAssertionError=void 0;var r=Ve(),o=m(Be()),c=Tn(),g=n("./src/asymmetricMatchers.ts"),u=_(n("./src/extractExpectedAssertionsErrors.ts")),b=n("./src/jestMatchersObject.ts"),L=_(n("./src/matchers.ts")),v=_(n("./src/spyMatchers.ts")),N=m(n("./src/toThrowMatchers.ts"));function _(j){return j&&j.__esModule?j:{default:j}}function m(j,P){if(typeof WeakMap=="function")var T=new WeakMap,f=new WeakMap;return(m=function(d,w){if(!w&&d&&d.__esModule)return d;var x,k,G={__proto__:null,default:d};if(d===null||typeof d!="object"&&typeof d!="function")return G;if(x=w?f:T){if(x.has(d))return x.get(d);x.set(d,G)}for(let W in d)W!=="default"&&{}.hasOwnProperty.call(d,W)&&((k=(x=Object.defineProperty)&&Object.getOwnPropertyDescriptor(d,W))&&(k.get||k.set)?x(G,W,k):G[W]=d[W]);return G})(j,P)}class A extends Error{constructor(){super(...arguments);Ce(this,"matcherResult")}}s.JestAssertionError=A;let p=function(j){return function(P,T){return j.apply(this,[P,T,!0])}},E=(j,P)=>j==="toThrow"?(0,N.createMatcher)(j,!0):j==="toThrowErrorMatchingSnapshot"||j==="toThrowErrorMatchingInlineSnapshot"?p(P):null,a=(j,...P)=>{if(P.length>0)throw new Error("Expect takes at most one argument.");let T=(0,b.getMatchers)(),f={not:{},rejects:{not:{}},resolves:{not:{}}},d=new A;for(let w of Object.keys(T)){let x=T[w],k=E(w,x)||x;f[w]=$(x,!1,"",j),f.not[w]=$(x,!0,"",j),f.resolves[w]=l(w,k,!1,j,d),f.resolves.not[w]=l(w,k,!0,j,d),f.rejects[w]=y(w,k,!1,j,d),f.rejects.not[w]=y(w,k,!0,j,d)}return f};s.expect=a;let h=j=>j&&j()||o.RECEIVED_COLOR("No message was specified for this matcher."),l=(j,P,T,f,d)=>(...w)=>{let x={isNot:T,promise:"resolves"},k=typeof f=="function"?f():f;if(!(0,c.isPromise)(k))throw new A(o.matcherErrorMessage(o.matcherHint(j,void 0,"",x),`${o.RECEIVED_COLOR("received")} value must be a promise or a function returning a promise`,o.printWithType("Received",f,o.printReceived)));let G=new A;return k.then(W=>$(P,T,"resolves",W,G).apply(null,w),W=>{throw d.message=`${o.matcherHint(j,void 0,"",x)}
|
||||
|
||||
Received promise rejected instead of resolved
|
||||
Rejected to value: ${o.printReceived(W)}`,d})},y=(j,P,T,f,d)=>(...w)=>{let x={isNot:T,promise:"rejects"},k=typeof f=="function"?f():f;if(!(0,c.isPromise)(k))throw new A(o.matcherErrorMessage(o.matcherHint(j,void 0,"",x),`${o.RECEIVED_COLOR("received")} value must be a promise or a function returning a promise`,o.printWithType("Received",f,o.printReceived)));let G=new A;return k.then(W=>{throw d.message=`${o.matcherHint(j,void 0,"",x)}
|
||||
|
||||
Received promise resolved instead of rejected
|
||||
Resolved to value: ${o.printReceived(W)}`,d},W=>$(P,T,"rejects",W,G).apply(null,w))},$=(j,P,T,f,d)=>function w(...x){let k=!0,G={...o,iterableEquality:r.iterableEquality,subsetEquality:r.subsetEquality},W={customTesters:(0,b.getCustomEqualityTesters)(),dontThrow:()=>k=!1,equals:r.equals,utils:G},se={...(0,b.getState)(),...W,error:d,isNot:P,promise:T},ue=(z,ie)=>{if(C(z),(0,b.getState)().assertionCalls++,z.pass&&P||!z.pass&&!P){let X=h(z.message),Y;if(d?(Y=d,Y.message=X):ie?(Y=ie,Y.message=X):(Y=new A(X),Error.captureStackTrace&&Error.captureStackTrace(Y,w)),Y.matcherResult={...z,message:X},k)throw Y;(0,b.getState)().suppressedErrors.push(Y)}else(0,b.getState)().numPassingAsserts++},ee=z=>{throw j[b.INTERNAL_MATCHER_FLAG]===!0&&!(z instanceof A)&&z.name!=="PrettyFormatPluginError"&&Error.captureStackTrace&&Error.captureStackTrace(z,w),z},q;try{if(q=j[b.INTERNAL_MATCHER_FLAG]===!0?j.call(se,f,...x):(function(){return j.call(se,f,...x)})(),(0,c.isPromise)(q)){let z=new A;return Error.captureStackTrace&&Error.captureStackTrace(z,w),q.then(ie=>ue(ie,z)).catch(ee)}else return ue(q)}catch(z){return ee(z)}};a.extend=j=>(0,b.setMatchers)(j,!1,a),a.addEqualityTesters=j=>(0,b.addCustomEqualityTesters)(j),a.anything=g.anything,a.any=g.any,a.not={arrayContaining:g.arrayNotContaining,arrayOf:g.notArrayOf,closeTo:g.notCloseTo,objectContaining:g.objectNotContaining,stringContaining:g.stringNotContaining,stringMatching:g.stringNotMatching},a.arrayContaining=g.arrayContaining,a.arrayOf=g.arrayOf,a.closeTo=g.closeTo,a.objectContaining=g.objectContaining,a.stringContaining=g.stringContaining,a.stringMatching=g.stringMatching;let C=j=>{if(typeof j!="object"||typeof j.pass!="boolean"||j.message&&typeof j.message!="string"&&typeof j.message!="function")throw new Error(`Unexpected return from a matcher function.
|
||||
Matcher functions should return an object in the following format:
|
||||
{message?: string | function, pass: boolean}
|
||||
'${o.stringify(j)}' was returned`)};function S(j){let P=new c.ErrorWithStack(void 0,S);(0,b.setState)({expectedAssertionsNumber:j,expectedAssertionsNumberError:P})}function R(...j){let P=new c.ErrorWithStack(void 0,R);o.ensureNoExpected(j[0],".hasAssertions"),(0,b.setState)({isExpectingAssertions:!0,isExpectingAssertionsError:P})}(0,b.setMatchers)(L.default,!0,a),(0,b.setMatchers)(v.default,!0,a),(0,b.setMatchers)(N.default,!0,a),a.assertions=S,a.hasAssertions=R,a.getState=b.getState,a.setState=b.setState,a.extractExpectedAssertionsErrors=u.default;var I=s.default=a})(),bu.exports=i})()});var Mc={};wu(Mc,{expect:()=>Ic});module.exports=Lu(Mc);var bt=$u(Eu(),1),Wl=bt.default.AsymmetricMatcher,Kl=bt.default.JestAssertionError,Vl=bt.default.expect,yu=bt.default.default;var Ic=yu;0&&(module.exports={expect});
|
||||
/*! Bundled license information:
|
||||
|
||||
@jest/get-type/build/index.js:
|
||||
@jest/expect-utils/build/index.js:
|
||||
pretty-format/build/index.js:
|
||||
@jest/diff-sequences/build/index.js:
|
||||
jest-diff/build/index.js:
|
||||
jest-matcher-utils/build/index.js:
|
||||
jest-util/build/index.js:
|
||||
jest-message-util/build/index.js:
|
||||
expect/build/index.js:
|
||||
(*!
|
||||
* /**
|
||||
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* *
|
||||
* * This source code is licensed under the MIT license found in the
|
||||
* * LICENSE file in the root directory of this source tree.
|
||||
* * /
|
||||
*)
|
||||
|
||||
react-is/cjs/react-is.production.min.js:
|
||||
(**
|
||||
* @license React
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
react-is/cjs/react-is.development.js:
|
||||
(**
|
||||
* @license React
|
||||
* react-is.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
is-number/index.js:
|
||||
(*!
|
||||
* is-number <https://github.com/jonschlinkert/is-number>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*)
|
||||
|
||||
to-regex-range/index.js:
|
||||
(*!
|
||||
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
||||
*
|
||||
* Copyright (c) 2015-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*)
|
||||
|
||||
fill-range/index.js:
|
||||
(*!
|
||||
* fill-range <https://github.com/jonschlinkert/fill-range>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*)
|
||||
*/
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var fixtures_exports = {};
|
||||
__export(fixtures_exports, {
|
||||
FixturePool: () => FixturePool,
|
||||
fixtureParameterNames: () => fixtureParameterNames,
|
||||
formatPotentiallyInternalLocation: () => formatPotentiallyInternalLocation,
|
||||
inheritFixtureNames: () => inheritFixtureNames
|
||||
});
|
||||
module.exports = __toCommonJS(fixtures_exports);
|
||||
var import_crypto = __toESM(require("crypto"));
|
||||
var import_util = require("../util");
|
||||
const kScopeOrder = ["test", "worker"];
|
||||
function isFixtureTuple(value) {
|
||||
return Array.isArray(value) && typeof value[1] === "object";
|
||||
}
|
||||
function isFixtureOption(value) {
|
||||
return isFixtureTuple(value) && !!value[1].option;
|
||||
}
|
||||
class FixturePool {
|
||||
constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
|
||||
this._registrations = new Map(parentPool ? parentPool._registrations : []);
|
||||
this._onLoadError = onLoadError;
|
||||
const allOverrides = optionOverrides?.overrides ?? {};
|
||||
const overrideKeys = new Set(Object.keys(allOverrides));
|
||||
for (const list of fixturesList) {
|
||||
this._appendFixtureList(list, !!disallowWorkerFixtures, false);
|
||||
const selectedOverrides = {};
|
||||
for (const [key, value] of Object.entries(list.fixtures)) {
|
||||
if (isFixtureOption(value) && overrideKeys.has(key))
|
||||
selectedOverrides[key] = [allOverrides[key], value[1]];
|
||||
}
|
||||
if (Object.entries(selectedOverrides).length)
|
||||
this._appendFixtureList({ fixtures: selectedOverrides, location: optionOverrides.location }, !!disallowWorkerFixtures, true);
|
||||
}
|
||||
this.digest = this.validate();
|
||||
}
|
||||
_appendFixtureList(list, disallowWorkerFixtures, isOptionsOverride) {
|
||||
const { fixtures, location } = list;
|
||||
for (const entry of Object.entries(fixtures)) {
|
||||
const name = entry[0];
|
||||
let value = entry[1];
|
||||
let options;
|
||||
if (isFixtureTuple(value)) {
|
||||
options = {
|
||||
auto: value[1].auto ?? false,
|
||||
scope: value[1].scope || "test",
|
||||
option: !!value[1].option,
|
||||
timeout: value[1].timeout,
|
||||
customTitle: value[1].title,
|
||||
box: value[1].box
|
||||
};
|
||||
value = value[0];
|
||||
}
|
||||
let fn = value;
|
||||
const previous = this._registrations.get(name);
|
||||
if (previous && options) {
|
||||
if (previous.scope !== options.scope) {
|
||||
this._addLoadError(`Fixture "${name}" has already been registered as a { scope: '${previous.scope}' } fixture defined in ${(0, import_util.formatLocation)(previous.location)}.`, location);
|
||||
continue;
|
||||
}
|
||||
if (previous.auto !== options.auto) {
|
||||
this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${(0, import_util.formatLocation)(previous.location)}.`, location);
|
||||
continue;
|
||||
}
|
||||
} else if (previous) {
|
||||
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
|
||||
} else if (!options) {
|
||||
options = { auto: false, scope: "test", option: false, timeout: void 0 };
|
||||
}
|
||||
if (!kScopeOrder.includes(options.scope)) {
|
||||
this._addLoadError(`Fixture "${name}" has unknown { scope: '${options.scope}' }.`, location);
|
||||
continue;
|
||||
}
|
||||
if (options.scope === "worker" && disallowWorkerFixtures) {
|
||||
this._addLoadError(`Cannot use({ ${name} }) in a describe group, because it forces a new worker.
|
||||
Make it top-level in the test file or put in the configuration file.`, location);
|
||||
continue;
|
||||
}
|
||||
if (fn === void 0 && options.option && previous) {
|
||||
let original = previous;
|
||||
while (!original.optionOverride && original.super)
|
||||
original = original.super;
|
||||
fn = original.fn;
|
||||
}
|
||||
const deps = fixtureParameterNames(fn, location, (e) => this._onLoadError(e));
|
||||
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
|
||||
registrationId(registration);
|
||||
this._registrations.set(name, registration);
|
||||
}
|
||||
}
|
||||
validate() {
|
||||
const markers = /* @__PURE__ */ new Map();
|
||||
const stack = [];
|
||||
let hasDependencyErrors = false;
|
||||
const addDependencyError = (message, location) => {
|
||||
hasDependencyErrors = true;
|
||||
this._addLoadError(message, location);
|
||||
};
|
||||
const visit = (registration, boxedOnly) => {
|
||||
markers.set(registration, "visiting");
|
||||
stack.push(registration);
|
||||
for (const name of registration.deps) {
|
||||
const dep = this.resolve(name, registration);
|
||||
if (!dep) {
|
||||
if (name === registration.name)
|
||||
addDependencyError(`Fixture "${registration.name}" references itself, but does not have a base implementation.`, registration.location);
|
||||
else
|
||||
addDependencyError(`Fixture "${registration.name}" has unknown parameter "${name}".`, registration.location);
|
||||
continue;
|
||||
}
|
||||
if (kScopeOrder.indexOf(registration.scope) > kScopeOrder.indexOf(dep.scope)) {
|
||||
addDependencyError(`${registration.scope} fixture "${registration.name}" cannot depend on a ${dep.scope} fixture "${name}" defined in ${formatPotentiallyInternalLocation(dep.location)}.`, registration.location);
|
||||
continue;
|
||||
}
|
||||
if (!markers.has(dep)) {
|
||||
visit(dep, boxedOnly);
|
||||
} else if (markers.get(dep) === "visiting") {
|
||||
const index = stack.indexOf(dep);
|
||||
const allRegs = stack.slice(index, stack.length);
|
||||
const filteredRegs = allRegs.filter((r) => !r.box);
|
||||
const regs = boxedOnly ? filteredRegs : allRegs;
|
||||
const names2 = regs.map((r) => `"${r.name}"`);
|
||||
addDependencyError(`Fixtures ${names2.join(" -> ")} -> "${dep.name}" form a dependency cycle: ${regs.map((r) => formatPotentiallyInternalLocation(r.location)).join(" -> ")} -> ${formatPotentiallyInternalLocation(dep.location)}`, dep.location);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
markers.set(registration, "visited");
|
||||
stack.pop();
|
||||
};
|
||||
const names = Array.from(this._registrations.keys()).sort();
|
||||
for (const name of names) {
|
||||
const registration = this._registrations.get(name);
|
||||
if (!registration.box)
|
||||
visit(registration, true);
|
||||
}
|
||||
if (!hasDependencyErrors) {
|
||||
for (const name of names) {
|
||||
const registration = this._registrations.get(name);
|
||||
if (registration.box)
|
||||
visit(registration, false);
|
||||
}
|
||||
}
|
||||
const hash = import_crypto.default.createHash("sha1");
|
||||
for (const name of names) {
|
||||
const registration = this._registrations.get(name);
|
||||
if (registration.scope === "worker")
|
||||
hash.update(registration.id + ";");
|
||||
}
|
||||
return hash.digest("hex");
|
||||
}
|
||||
validateFunction(fn, prefix, location) {
|
||||
for (const name of fixtureParameterNames(fn, location, (e) => this._onLoadError(e))) {
|
||||
const registration = this._registrations.get(name);
|
||||
if (!registration)
|
||||
this._addLoadError(`${prefix} has unknown parameter "${name}".`, location);
|
||||
}
|
||||
}
|
||||
resolve(name, forFixture) {
|
||||
if (name === forFixture?.name)
|
||||
return forFixture.super;
|
||||
return this._registrations.get(name);
|
||||
}
|
||||
autoFixtures() {
|
||||
return [...this._registrations.values()].filter((r) => r.auto !== false);
|
||||
}
|
||||
_addLoadError(message, location) {
|
||||
this._onLoadError({ message, location });
|
||||
}
|
||||
}
|
||||
const signatureSymbol = Symbol("signature");
|
||||
function formatPotentiallyInternalLocation(location) {
|
||||
const isUserFixture = location && (0, import_util.filterStackFile)(location.file);
|
||||
return isUserFixture ? (0, import_util.formatLocation)(location) : "<builtin>";
|
||||
}
|
||||
function fixtureParameterNames(fn, location, onError) {
|
||||
if (typeof fn !== "function")
|
||||
return [];
|
||||
if (!fn[signatureSymbol])
|
||||
fn[signatureSymbol] = innerFixtureParameterNames(fn, location, onError);
|
||||
return fn[signatureSymbol];
|
||||
}
|
||||
function inheritFixtureNames(from, to) {
|
||||
to[signatureSymbol] = from[signatureSymbol];
|
||||
}
|
||||
function innerFixtureParameterNames(fn, location, onError) {
|
||||
const text = filterOutComments(fn.toString());
|
||||
const match = text.match(/(?:async)?(?:\s+function)?[^(]*\(([^)]*)/);
|
||||
if (!match)
|
||||
return [];
|
||||
const trimmedParams = match[1].trim();
|
||||
if (!trimmedParams)
|
||||
return [];
|
||||
const [firstParam] = splitByComma(trimmedParams);
|
||||
if (firstParam[0] !== "{" || firstParam[firstParam.length - 1] !== "}") {
|
||||
onError({ message: "First argument must use the object destructuring pattern: " + firstParam, location });
|
||||
return [];
|
||||
}
|
||||
const props = splitByComma(firstParam.substring(1, firstParam.length - 1)).map((prop) => {
|
||||
const colon = prop.indexOf(":");
|
||||
return colon === -1 ? prop.trim() : prop.substring(0, colon).trim();
|
||||
});
|
||||
const restProperty = props.find((prop) => prop.startsWith("..."));
|
||||
if (restProperty) {
|
||||
onError({ message: `Rest property "${restProperty}" is not supported. List all used fixtures explicitly, separated by comma.`, location });
|
||||
return [];
|
||||
}
|
||||
return props;
|
||||
}
|
||||
function filterOutComments(s) {
|
||||
const result = [];
|
||||
let commentState = "none";
|
||||
for (let i = 0; i < s.length; ++i) {
|
||||
if (commentState === "singleline") {
|
||||
if (s[i] === "\n")
|
||||
commentState = "none";
|
||||
} else if (commentState === "multiline") {
|
||||
if (s[i - 1] === "*" && s[i] === "/")
|
||||
commentState = "none";
|
||||
} else if (commentState === "none") {
|
||||
if (s[i] === "/" && s[i + 1] === "/") {
|
||||
commentState = "singleline";
|
||||
} else if (s[i] === "/" && s[i + 1] === "*") {
|
||||
commentState = "multiline";
|
||||
i += 2;
|
||||
} else {
|
||||
result.push(s[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.join("");
|
||||
}
|
||||
function splitByComma(s) {
|
||||
const result = [];
|
||||
const stack = [];
|
||||
let start = 0;
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
if (s[i] === "{" || s[i] === "[") {
|
||||
stack.push(s[i] === "{" ? "}" : "]");
|
||||
} else if (s[i] === stack[stack.length - 1]) {
|
||||
stack.pop();
|
||||
} else if (!stack.length && s[i] === ",") {
|
||||
const token = s.substring(start, i).trim();
|
||||
if (token)
|
||||
result.push(token);
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
const lastToken = s.substring(start).trim();
|
||||
if (lastToken)
|
||||
result.push(lastToken);
|
||||
return result;
|
||||
}
|
||||
const registrationIdMap = /* @__PURE__ */ new Map();
|
||||
let lastId = 0;
|
||||
function registrationId(registration) {
|
||||
if (registration.id)
|
||||
return registration.id;
|
||||
const key = registration.name + "@@@" + (registration.super ? registrationId(registration.super) : "");
|
||||
let map = registrationIdMap.get(key);
|
||||
if (!map) {
|
||||
map = /* @__PURE__ */ new Map();
|
||||
registrationIdMap.set(key, map);
|
||||
}
|
||||
if (!map.has(registration.fn))
|
||||
map.set(registration.fn, String(lastId++));
|
||||
registration.id = map.get(registration.fn);
|
||||
return registration.id;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FixturePool,
|
||||
fixtureParameterNames,
|
||||
formatPotentiallyInternalLocation,
|
||||
inheritFixtureNames
|
||||
});
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var globals_exports = {};
|
||||
__export(globals_exports, {
|
||||
currentTestInfo: () => currentTestInfo,
|
||||
currentlyLoadingFileSuite: () => currentlyLoadingFileSuite,
|
||||
isWorkerProcess: () => isWorkerProcess,
|
||||
setCurrentTestInfo: () => setCurrentTestInfo,
|
||||
setCurrentlyLoadingFileSuite: () => setCurrentlyLoadingFileSuite,
|
||||
setIsWorkerProcess: () => setIsWorkerProcess
|
||||
});
|
||||
module.exports = __toCommonJS(globals_exports);
|
||||
let currentTestInfoValue = null;
|
||||
function setCurrentTestInfo(testInfo) {
|
||||
currentTestInfoValue = testInfo;
|
||||
}
|
||||
function currentTestInfo() {
|
||||
return currentTestInfoValue;
|
||||
}
|
||||
let currentFileSuite;
|
||||
function setCurrentlyLoadingFileSuite(suite) {
|
||||
currentFileSuite = suite;
|
||||
}
|
||||
function currentlyLoadingFileSuite() {
|
||||
return currentFileSuite;
|
||||
}
|
||||
let _isWorkerProcess = false;
|
||||
function setIsWorkerProcess() {
|
||||
_isWorkerProcess = true;
|
||||
}
|
||||
function isWorkerProcess() {
|
||||
return _isWorkerProcess;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
currentTestInfo,
|
||||
currentlyLoadingFileSuite,
|
||||
isWorkerProcess,
|
||||
setCurrentTestInfo,
|
||||
setCurrentlyLoadingFileSuite,
|
||||
setIsWorkerProcess
|
||||
});
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ipc_exports = {};
|
||||
__export(ipc_exports, {
|
||||
serializeConfig: () => serializeConfig,
|
||||
stdioChunkToParams: () => stdioChunkToParams
|
||||
});
|
||||
module.exports = __toCommonJS(ipc_exports);
|
||||
var import_util = __toESM(require("util"));
|
||||
var import_compilationCache = require("../transform/compilationCache");
|
||||
function serializeConfig(config, passCompilationCache) {
|
||||
const result = {
|
||||
location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
|
||||
configCLIOverrides: config.configCLIOverrides,
|
||||
compilationCache: passCompilationCache ? (0, import_compilationCache.serializeCompilationCache)() : void 0
|
||||
};
|
||||
try {
|
||||
result.metadata = JSON.stringify(config.config.metadata);
|
||||
} catch (error) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function stdioChunkToParams(chunk) {
|
||||
if (chunk instanceof Uint8Array)
|
||||
return { buffer: Buffer.from(chunk).toString("base64") };
|
||||
if (typeof chunk !== "string")
|
||||
return { text: import_util.default.inspect(chunk) };
|
||||
return { text: chunk };
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
serializeConfig,
|
||||
stdioChunkToParams
|
||||
});
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var poolBuilder_exports = {};
|
||||
__export(poolBuilder_exports, {
|
||||
PoolBuilder: () => PoolBuilder
|
||||
});
|
||||
module.exports = __toCommonJS(poolBuilder_exports);
|
||||
var import_fixtures = require("./fixtures");
|
||||
var import_util = require("../util");
|
||||
class PoolBuilder {
|
||||
constructor(type, project) {
|
||||
this._testTypePools = /* @__PURE__ */ new Map();
|
||||
this._type = type;
|
||||
this._project = project;
|
||||
}
|
||||
static createForLoader() {
|
||||
return new PoolBuilder("loader");
|
||||
}
|
||||
static createForWorker(project) {
|
||||
return new PoolBuilder("worker", project);
|
||||
}
|
||||
buildPools(suite, testErrors) {
|
||||
suite.forEachTest((test) => {
|
||||
const pool = this._buildPoolForTest(test, testErrors);
|
||||
if (this._type === "loader")
|
||||
test._poolDigest = pool.digest;
|
||||
if (this._type === "worker")
|
||||
test._pool = pool;
|
||||
});
|
||||
}
|
||||
_buildPoolForTest(test, testErrors) {
|
||||
let pool = this._buildTestTypePool(test._testType, testErrors);
|
||||
const parents = [];
|
||||
for (let parent = test.parent; parent; parent = parent.parent)
|
||||
parents.push(parent);
|
||||
parents.reverse();
|
||||
for (const parent of parents) {
|
||||
if (parent._use.length)
|
||||
pool = new import_fixtures.FixturePool(parent._use, (e) => this._handleLoadError(e, testErrors), pool, parent._type === "describe");
|
||||
for (const hook of parent._hooks)
|
||||
pool.validateFunction(hook.fn, hook.type + " hook", hook.location);
|
||||
for (const modifier of parent._modifiers)
|
||||
pool.validateFunction(modifier.fn, modifier.type + " modifier", modifier.location);
|
||||
}
|
||||
pool.validateFunction(test.fn, "Test", test.location);
|
||||
return pool;
|
||||
}
|
||||
_buildTestTypePool(testType, testErrors) {
|
||||
if (!this._testTypePools.has(testType)) {
|
||||
const optionOverrides = {
|
||||
overrides: this._project?.project?.use ?? {},
|
||||
location: { file: `project#${this._project?.id}`, line: 1, column: 1 }
|
||||
};
|
||||
const pool = new import_fixtures.FixturePool(testType.fixtures, (e) => this._handleLoadError(e, testErrors), void 0, void 0, optionOverrides);
|
||||
this._testTypePools.set(testType, pool);
|
||||
}
|
||||
return this._testTypePools.get(testType);
|
||||
}
|
||||
_handleLoadError(e, testErrors) {
|
||||
if (testErrors)
|
||||
testErrors.push(e);
|
||||
else
|
||||
throw new Error(`${(0, import_util.formatLocation)(e.location)}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
PoolBuilder
|
||||
});
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var process_exports = {};
|
||||
__export(process_exports, {
|
||||
ProcessRunner: () => ProcessRunner
|
||||
});
|
||||
module.exports = __toCommonJS(process_exports);
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_util = require("../util");
|
||||
class ProcessRunner {
|
||||
async gracefullyClose() {
|
||||
}
|
||||
dispatchEvent(method, params) {
|
||||
const response = { method, params };
|
||||
sendMessageToParent({ method: "__dispatch__", params: response });
|
||||
}
|
||||
async sendRequest(method, params) {
|
||||
return await sendRequestToParent(method, params);
|
||||
}
|
||||
async sendMessageNoReply(method, params) {
|
||||
void sendRequestToParent(method, params).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
let gracefullyCloseCalled = false;
|
||||
let forceExitInitiated = false;
|
||||
sendMessageToParent({ method: "ready" });
|
||||
process.on("disconnect", () => gracefullyCloseAndExit(true));
|
||||
process.on("SIGINT", () => {
|
||||
});
|
||||
process.on("SIGTERM", () => {
|
||||
});
|
||||
let processRunner;
|
||||
let processName;
|
||||
const startingEnv = { ...process.env };
|
||||
process.on("message", async (message) => {
|
||||
if (message.method === "__init__") {
|
||||
const { processParams, runnerParams, runnerScript } = message.params;
|
||||
void (0, import_utils.startProfiling)();
|
||||
(0, import_utils.setTimeOrigin)(processParams.timeOrigin);
|
||||
const { create } = require(runnerScript);
|
||||
processRunner = create(runnerParams);
|
||||
processName = processParams.processName;
|
||||
return;
|
||||
}
|
||||
if (message.method === "__stop__") {
|
||||
const keys = /* @__PURE__ */ new Set([...Object.keys(process.env), ...Object.keys(startingEnv)]);
|
||||
const producedEnv = [...keys].filter((key) => startingEnv[key] !== process.env[key]).map((key) => [key, process.env[key] ?? null]);
|
||||
sendMessageToParent({ method: "__env_produced__", params: producedEnv });
|
||||
await gracefullyCloseAndExit(false);
|
||||
return;
|
||||
}
|
||||
if (message.method === "__dispatch__") {
|
||||
const { id, method, params } = message.params;
|
||||
try {
|
||||
const result = await processRunner[method](params);
|
||||
const response = { id, result };
|
||||
sendMessageToParent({ method: "__dispatch__", params: response });
|
||||
} catch (e) {
|
||||
const response = { id, error: (0, import_util.serializeError)(e) };
|
||||
sendMessageToParent({ method: "__dispatch__", params: response });
|
||||
}
|
||||
}
|
||||
if (message.method === "__response__")
|
||||
handleResponseFromParent(message.params);
|
||||
});
|
||||
const kForceExitTimeout = +(process.env.PWTEST_FORCE_EXIT_TIMEOUT || 3e4);
|
||||
async function gracefullyCloseAndExit(forceExit) {
|
||||
if (forceExit && !forceExitInitiated) {
|
||||
forceExitInitiated = true;
|
||||
setTimeout(() => process.exit(0), kForceExitTimeout);
|
||||
}
|
||||
if (!gracefullyCloseCalled) {
|
||||
gracefullyCloseCalled = true;
|
||||
await processRunner?.gracefullyClose().catch(() => {
|
||||
});
|
||||
if (processName)
|
||||
await (0, import_utils.stopProfiling)(processName).catch(() => {
|
||||
});
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
function sendMessageToParent(message) {
|
||||
try {
|
||||
process.send(message);
|
||||
} catch (e) {
|
||||
try {
|
||||
JSON.stringify(message);
|
||||
} catch {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
let lastId = 0;
|
||||
const requestCallbacks = /* @__PURE__ */ new Map();
|
||||
async function sendRequestToParent(method, params) {
|
||||
const id = ++lastId;
|
||||
sendMessageToParent({ method: "__request__", params: { id, method, params } });
|
||||
const promise = new import_utils.ManualPromise();
|
||||
requestCallbacks.set(id, promise);
|
||||
return promise;
|
||||
}
|
||||
function handleResponseFromParent(response) {
|
||||
const promise = requestCallbacks.get(response.id);
|
||||
if (!promise)
|
||||
return;
|
||||
requestCallbacks.delete(response.id);
|
||||
if (response.error)
|
||||
promise.reject(new Error(response.error.message));
|
||||
else
|
||||
promise.resolve(response.result);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ProcessRunner
|
||||
});
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var suiteUtils_exports = {};
|
||||
__export(suiteUtils_exports, {
|
||||
applyRepeatEachIndex: () => applyRepeatEachIndex,
|
||||
bindFileSuiteToProject: () => bindFileSuiteToProject,
|
||||
filterByFocusedLine: () => filterByFocusedLine,
|
||||
filterOnly: () => filterOnly,
|
||||
filterSuite: () => filterSuite,
|
||||
filterTestsRemoveEmptySuites: () => filterTestsRemoveEmptySuites
|
||||
});
|
||||
module.exports = __toCommonJS(suiteUtils_exports);
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_util = require("../util");
|
||||
function filterSuite(suite, suiteFilter, testFilter) {
|
||||
for (const child of suite.suites) {
|
||||
if (!suiteFilter(child))
|
||||
filterSuite(child, suiteFilter, testFilter);
|
||||
}
|
||||
const filteredTests = suite.tests.filter(testFilter);
|
||||
const entries = /* @__PURE__ */ new Set([...suite.suites, ...filteredTests]);
|
||||
suite._entries = suite._entries.filter((e) => entries.has(e));
|
||||
}
|
||||
function filterTestsRemoveEmptySuites(suite, filter) {
|
||||
const filteredSuites = suite.suites.filter((child) => filterTestsRemoveEmptySuites(child, filter));
|
||||
const filteredTests = suite.tests.filter(filter);
|
||||
const entries = /* @__PURE__ */ new Set([...filteredSuites, ...filteredTests]);
|
||||
suite._entries = suite._entries.filter((e) => entries.has(e));
|
||||
return !!suite._entries.length;
|
||||
}
|
||||
function bindFileSuiteToProject(project, suite) {
|
||||
const relativeFile = import_path.default.relative(project.project.testDir, suite.location.file);
|
||||
const fileId = (0, import_utils.calculateSha1)((0, import_utils.toPosixPath)(relativeFile)).slice(0, 20);
|
||||
const result = suite._deepClone();
|
||||
result._fileId = fileId;
|
||||
result.forEachTest((test, suite2) => {
|
||||
suite2._fileId = fileId;
|
||||
const [file, ...titles] = test.titlePath();
|
||||
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")}`;
|
||||
const testId = fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
|
||||
test.id = testId;
|
||||
test._projectId = project.id;
|
||||
let inheritedRetries;
|
||||
let inheritedTimeout;
|
||||
for (let parentSuite = suite2; parentSuite; parentSuite = parentSuite.parent) {
|
||||
if (parentSuite._staticAnnotations.length)
|
||||
test.annotations.unshift(...parentSuite._staticAnnotations);
|
||||
if (inheritedRetries === void 0 && parentSuite._retries !== void 0)
|
||||
inheritedRetries = parentSuite._retries;
|
||||
if (inheritedTimeout === void 0 && parentSuite._timeout !== void 0)
|
||||
inheritedTimeout = parentSuite._timeout;
|
||||
}
|
||||
test.retries = inheritedRetries ?? project.project.retries;
|
||||
test.timeout = inheritedTimeout ?? project.project.timeout;
|
||||
if (test.annotations.some((a) => a.type === "skip" || a.type === "fixme"))
|
||||
test.expectedStatus = "skipped";
|
||||
if (test._poolDigest)
|
||||
test._workerHash = `${project.id}-${test._poolDigest}-0`;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function applyRepeatEachIndex(project, fileSuite, repeatEachIndex) {
|
||||
fileSuite.forEachTest((test, suite) => {
|
||||
if (repeatEachIndex) {
|
||||
const [file, ...titles] = test.titlePath();
|
||||
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")} (repeat:${repeatEachIndex})`;
|
||||
const testId = suite._fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
|
||||
test.id = testId;
|
||||
test.repeatEachIndex = repeatEachIndex;
|
||||
if (test._poolDigest)
|
||||
test._workerHash = `${project.id}-${test._poolDigest}-${repeatEachIndex}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
function filterOnly(suite) {
|
||||
if (!suite._getOnlyItems().length)
|
||||
return;
|
||||
const suiteFilter = (suite2) => suite2._only;
|
||||
const testFilter = (test) => test._only;
|
||||
return filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter);
|
||||
}
|
||||
function filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter) {
|
||||
const onlySuites = suite.suites.filter((child) => filterSuiteWithOnlySemantics(child, suiteFilter, testFilter) || suiteFilter(child));
|
||||
const onlyTests = suite.tests.filter(testFilter);
|
||||
const onlyEntries = /* @__PURE__ */ new Set([...onlySuites, ...onlyTests]);
|
||||
if (onlyEntries.size) {
|
||||
suite._entries = suite._entries.filter((e) => onlyEntries.has(e));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function filterByFocusedLine(suite, focusedTestFileLines) {
|
||||
if (!focusedTestFileLines.length)
|
||||
return;
|
||||
const matchers = focusedTestFileLines.map(createFileMatcherFromFilter);
|
||||
const testFileLineMatches = (testFileName, testLine, testColumn) => matchers.some((m) => m(testFileName, testLine, testColumn));
|
||||
const suiteFilter = (suite2) => !!suite2.location && testFileLineMatches(suite2.location.file, suite2.location.line, suite2.location.column);
|
||||
const testFilter = (test) => testFileLineMatches(test.location.file, test.location.line, test.location.column);
|
||||
return filterSuite(suite, suiteFilter, testFilter);
|
||||
}
|
||||
function createFileMatcherFromFilter(filter) {
|
||||
const fileMatcher = (0, import_util.createFileMatcher)(filter.re || filter.exact || "");
|
||||
return (testFileName, testLine, testColumn) => fileMatcher(testFileName) && (filter.line === testLine || filter.line === null) && (filter.column === testColumn || filter.column === null);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
applyRepeatEachIndex,
|
||||
bindFileSuiteToProject,
|
||||
filterByFocusedLine,
|
||||
filterOnly,
|
||||
filterSuite,
|
||||
filterTestsRemoveEmptySuites
|
||||
});
|
||||
+321
@@ -0,0 +1,321 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var test_exports = {};
|
||||
__export(test_exports, {
|
||||
Suite: () => Suite,
|
||||
TestCase: () => TestCase
|
||||
});
|
||||
module.exports = __toCommonJS(test_exports);
|
||||
var import_testType = require("./testType");
|
||||
var import_teleReceiver = require("../isomorphic/teleReceiver");
|
||||
class Base {
|
||||
constructor(title) {
|
||||
this._only = false;
|
||||
this._requireFile = "";
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
class Suite extends Base {
|
||||
constructor(title, type) {
|
||||
super(title);
|
||||
this._use = [];
|
||||
this._entries = [];
|
||||
this._hooks = [];
|
||||
// Annotations known statically before running the test, e.g. `test.describe.skip()` or `test.describe({ annotation }, body)`.
|
||||
this._staticAnnotations = [];
|
||||
// Explicitly declared tags that are not a part of the title.
|
||||
this._tags = [];
|
||||
this._modifiers = [];
|
||||
this._parallelMode = "none";
|
||||
this._type = type;
|
||||
}
|
||||
get type() {
|
||||
return this._type;
|
||||
}
|
||||
entries() {
|
||||
return this._entries;
|
||||
}
|
||||
get suites() {
|
||||
return this._entries.filter((entry) => entry instanceof Suite);
|
||||
}
|
||||
get tests() {
|
||||
return this._entries.filter((entry) => entry instanceof TestCase);
|
||||
}
|
||||
_addTest(test) {
|
||||
test.parent = this;
|
||||
this._entries.push(test);
|
||||
}
|
||||
_addSuite(suite) {
|
||||
suite.parent = this;
|
||||
this._entries.push(suite);
|
||||
}
|
||||
_prependSuite(suite) {
|
||||
suite.parent = this;
|
||||
this._entries.unshift(suite);
|
||||
}
|
||||
allTests() {
|
||||
const result = [];
|
||||
const visit = (suite) => {
|
||||
for (const entry of suite._entries) {
|
||||
if (entry instanceof Suite)
|
||||
visit(entry);
|
||||
else
|
||||
result.push(entry);
|
||||
}
|
||||
};
|
||||
visit(this);
|
||||
return result;
|
||||
}
|
||||
_hasTests() {
|
||||
let result = false;
|
||||
const visit = (suite) => {
|
||||
for (const entry of suite._entries) {
|
||||
if (result)
|
||||
return;
|
||||
if (entry instanceof Suite)
|
||||
visit(entry);
|
||||
else
|
||||
result = true;
|
||||
}
|
||||
};
|
||||
visit(this);
|
||||
return result;
|
||||
}
|
||||
titlePath() {
|
||||
const titlePath = this.parent ? this.parent.titlePath() : [];
|
||||
if (this.title || this._type !== "describe")
|
||||
titlePath.push(this.title);
|
||||
return titlePath;
|
||||
}
|
||||
_collectGrepTitlePath(path) {
|
||||
if (this.parent)
|
||||
this.parent._collectGrepTitlePath(path);
|
||||
if (this.title || this._type !== "describe")
|
||||
path.push(this.title);
|
||||
path.push(...this._tags);
|
||||
}
|
||||
_getOnlyItems() {
|
||||
const items = [];
|
||||
if (this._only)
|
||||
items.push(this);
|
||||
for (const suite of this.suites)
|
||||
items.push(...suite._getOnlyItems());
|
||||
items.push(...this.tests.filter((test) => test._only));
|
||||
return items;
|
||||
}
|
||||
_deepClone() {
|
||||
const suite = this._clone();
|
||||
for (const entry of this._entries) {
|
||||
if (entry instanceof Suite)
|
||||
suite._addSuite(entry._deepClone());
|
||||
else
|
||||
suite._addTest(entry._clone());
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
_deepSerialize() {
|
||||
const suite = this._serialize();
|
||||
suite.entries = [];
|
||||
for (const entry of this._entries) {
|
||||
if (entry instanceof Suite)
|
||||
suite.entries.push(entry._deepSerialize());
|
||||
else
|
||||
suite.entries.push(entry._serialize());
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
static _deepParse(data) {
|
||||
const suite = Suite._parse(data);
|
||||
for (const entry of data.entries) {
|
||||
if (entry.kind === "suite")
|
||||
suite._addSuite(Suite._deepParse(entry));
|
||||
else
|
||||
suite._addTest(TestCase._parse(entry));
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
forEachTest(visitor) {
|
||||
for (const entry of this._entries) {
|
||||
if (entry instanceof Suite)
|
||||
entry.forEachTest(visitor);
|
||||
else
|
||||
visitor(entry, this);
|
||||
}
|
||||
}
|
||||
_serialize() {
|
||||
return {
|
||||
kind: "suite",
|
||||
title: this.title,
|
||||
type: this._type,
|
||||
location: this.location,
|
||||
only: this._only,
|
||||
requireFile: this._requireFile,
|
||||
timeout: this._timeout,
|
||||
retries: this._retries,
|
||||
staticAnnotations: this._staticAnnotations.slice(),
|
||||
tags: this._tags.slice(),
|
||||
modifiers: this._modifiers.slice(),
|
||||
parallelMode: this._parallelMode,
|
||||
hooks: this._hooks.map((h) => ({ type: h.type, location: h.location, title: h.title })),
|
||||
fileId: this._fileId
|
||||
};
|
||||
}
|
||||
static _parse(data) {
|
||||
const suite = new Suite(data.title, data.type);
|
||||
suite.location = data.location;
|
||||
suite._only = data.only;
|
||||
suite._requireFile = data.requireFile;
|
||||
suite._timeout = data.timeout;
|
||||
suite._retries = data.retries;
|
||||
suite._staticAnnotations = data.staticAnnotations;
|
||||
suite._tags = data.tags;
|
||||
suite._modifiers = data.modifiers;
|
||||
suite._parallelMode = data.parallelMode;
|
||||
suite._hooks = data.hooks.map((h) => ({ type: h.type, location: h.location, title: h.title, fn: () => {
|
||||
} }));
|
||||
suite._fileId = data.fileId;
|
||||
return suite;
|
||||
}
|
||||
_clone() {
|
||||
const data = this._serialize();
|
||||
const suite = Suite._parse(data);
|
||||
suite._use = this._use.slice();
|
||||
suite._hooks = this._hooks.slice();
|
||||
suite._fullProject = this._fullProject;
|
||||
return suite;
|
||||
}
|
||||
project() {
|
||||
return this._fullProject?.project || this.parent?.project();
|
||||
}
|
||||
}
|
||||
class TestCase extends Base {
|
||||
constructor(title, fn, testType, location) {
|
||||
super(title);
|
||||
this.results = [];
|
||||
this.type = "test";
|
||||
this.expectedStatus = "passed";
|
||||
this.timeout = 0;
|
||||
this.annotations = [];
|
||||
this.retries = 0;
|
||||
this.repeatEachIndex = 0;
|
||||
this.id = "";
|
||||
this._poolDigest = "";
|
||||
this._workerHash = "";
|
||||
this._projectId = "";
|
||||
// Explicitly declared tags that are not a part of the title.
|
||||
this._tags = [];
|
||||
this.fn = fn;
|
||||
this._testType = testType;
|
||||
this.location = location;
|
||||
}
|
||||
titlePath() {
|
||||
const titlePath = this.parent ? this.parent.titlePath() : [];
|
||||
titlePath.push(this.title);
|
||||
return titlePath;
|
||||
}
|
||||
outcome() {
|
||||
return (0, import_teleReceiver.computeTestCaseOutcome)(this);
|
||||
}
|
||||
ok() {
|
||||
const status = this.outcome();
|
||||
return status === "expected" || status === "flaky" || status === "skipped";
|
||||
}
|
||||
get tags() {
|
||||
const titleTags = this._grepBaseTitlePath().join(" ").match(/@[\S]+/g) || [];
|
||||
return [
|
||||
...titleTags,
|
||||
...this._tags
|
||||
];
|
||||
}
|
||||
_serialize() {
|
||||
return {
|
||||
kind: "test",
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
retries: this.retries,
|
||||
timeout: this.timeout,
|
||||
expectedStatus: this.expectedStatus,
|
||||
location: this.location,
|
||||
only: this._only,
|
||||
requireFile: this._requireFile,
|
||||
poolDigest: this._poolDigest,
|
||||
workerHash: this._workerHash,
|
||||
annotations: this.annotations.slice(),
|
||||
tags: this._tags.slice(),
|
||||
projectId: this._projectId
|
||||
};
|
||||
}
|
||||
static _parse(data) {
|
||||
const test = new TestCase(data.title, () => {
|
||||
}, import_testType.rootTestType, data.location);
|
||||
test.id = data.id;
|
||||
test.retries = data.retries;
|
||||
test.timeout = data.timeout;
|
||||
test.expectedStatus = data.expectedStatus;
|
||||
test._only = data.only;
|
||||
test._requireFile = data.requireFile;
|
||||
test._poolDigest = data.poolDigest;
|
||||
test._workerHash = data.workerHash;
|
||||
test.annotations = data.annotations;
|
||||
test._tags = data.tags;
|
||||
test._projectId = data.projectId;
|
||||
return test;
|
||||
}
|
||||
_clone() {
|
||||
const data = this._serialize();
|
||||
const test = TestCase._parse(data);
|
||||
test._testType = this._testType;
|
||||
test.fn = this.fn;
|
||||
return test;
|
||||
}
|
||||
_appendTestResult() {
|
||||
const result = {
|
||||
retry: this.results.length,
|
||||
parallelIndex: -1,
|
||||
workerIndex: -1,
|
||||
duration: 0,
|
||||
startTime: /* @__PURE__ */ new Date(),
|
||||
stdout: [],
|
||||
stderr: [],
|
||||
attachments: [],
|
||||
status: "skipped",
|
||||
steps: [],
|
||||
errors: [],
|
||||
annotations: []
|
||||
};
|
||||
this.results.push(result);
|
||||
return result;
|
||||
}
|
||||
_grepBaseTitlePath() {
|
||||
const path = [];
|
||||
this.parent._collectGrepTitlePath(path);
|
||||
path.push(this.title);
|
||||
return path;
|
||||
}
|
||||
_grepTitleWithTags() {
|
||||
const path = this._grepBaseTitlePath();
|
||||
path.push(...this._tags);
|
||||
return path.join(" ");
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Suite,
|
||||
TestCase
|
||||
});
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testLoader_exports = {};
|
||||
__export(testLoader_exports, {
|
||||
defaultTimeout: () => defaultTimeout,
|
||||
loadTestFile: () => loadTestFile
|
||||
});
|
||||
module.exports = __toCommonJS(testLoader_exports);
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_util = __toESM(require("util"));
|
||||
var esmLoaderHost = __toESM(require("./esmLoaderHost"));
|
||||
var import_globals = require("./globals");
|
||||
var import_test = require("./test");
|
||||
var import_compilationCache = require("../transform/compilationCache");
|
||||
var import_transform = require("../transform/transform");
|
||||
var import_util2 = require("../util");
|
||||
const defaultTimeout = 3e4;
|
||||
const cachedFileSuites = /* @__PURE__ */ new Map();
|
||||
async function loadTestFile(file, config, testErrors) {
|
||||
if (cachedFileSuites.has(file))
|
||||
return cachedFileSuites.get(file);
|
||||
const suite = new import_test.Suite(import_path.default.relative(config.config.rootDir, file) || import_path.default.basename(file), "file");
|
||||
suite._requireFile = file;
|
||||
suite.location = { file, line: 0, column: 0 };
|
||||
suite._tags = [...config.config.tags];
|
||||
(0, import_globals.setCurrentlyLoadingFileSuite)(suite);
|
||||
if (!(0, import_globals.isWorkerProcess)()) {
|
||||
(0, import_compilationCache.startCollectingFileDeps)();
|
||||
await esmLoaderHost.startCollectingFileDeps();
|
||||
}
|
||||
try {
|
||||
await (0, import_transform.requireOrImport)(file);
|
||||
cachedFileSuites.set(file, suite);
|
||||
} catch (e) {
|
||||
if (!testErrors)
|
||||
throw e;
|
||||
testErrors.push(serializeLoadError(file, e));
|
||||
} finally {
|
||||
(0, import_globals.setCurrentlyLoadingFileSuite)(void 0);
|
||||
if (!(0, import_globals.isWorkerProcess)()) {
|
||||
(0, import_compilationCache.stopCollectingFileDeps)(file);
|
||||
await esmLoaderHost.stopCollectingFileDeps(file);
|
||||
}
|
||||
}
|
||||
{
|
||||
const files = /* @__PURE__ */ new Set();
|
||||
suite.allTests().map((t) => files.add(t.location.file));
|
||||
if (files.size === 1) {
|
||||
const mappedFile = files.values().next().value;
|
||||
if (suite.location.file !== mappedFile) {
|
||||
if (import_path.default.extname(mappedFile) !== import_path.default.extname(suite.location.file))
|
||||
suite.location.file = mappedFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
function serializeLoadError(file, error) {
|
||||
if (error instanceof Error) {
|
||||
const result = (0, import_util2.filterStackTrace)(error);
|
||||
const loc = error.loc;
|
||||
result.location = loc ? {
|
||||
file,
|
||||
line: loc.line || 0,
|
||||
column: loc.column || 0
|
||||
} : void 0;
|
||||
return result;
|
||||
}
|
||||
return { value: import_util.default.inspect(error) };
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
defaultTimeout,
|
||||
loadTestFile
|
||||
});
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testType_exports = {};
|
||||
__export(testType_exports, {
|
||||
TestTypeImpl: () => TestTypeImpl,
|
||||
mergeTests: () => mergeTests,
|
||||
rootTestType: () => rootTestType
|
||||
});
|
||||
module.exports = __toCommonJS(testType_exports);
|
||||
var import_playwright_core = require("playwright-core");
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_globals = require("./globals");
|
||||
var import_test = require("./test");
|
||||
var import_expect = require("../matchers/expect");
|
||||
var import_transform = require("../transform/transform");
|
||||
var import_validators = require("./validators");
|
||||
const testTypeSymbol = Symbol("testType");
|
||||
class TestTypeImpl {
|
||||
constructor(fixtures) {
|
||||
this.fixtures = fixtures;
|
||||
const test = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "default"));
|
||||
test[testTypeSymbol] = this;
|
||||
test.expect = import_expect.expect;
|
||||
test.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "only"));
|
||||
test.describe = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "default"));
|
||||
test.describe.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "only"));
|
||||
test.describe.configure = (0, import_transform.wrapFunctionWithLocation)(this._configure.bind(this));
|
||||
test.describe.fixme = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "fixme"));
|
||||
test.describe.parallel = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel"));
|
||||
test.describe.parallel.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel.only"));
|
||||
test.describe.serial = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial"));
|
||||
test.describe.serial.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial.only"));
|
||||
test.describe.skip = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "skip"));
|
||||
test.beforeEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeEach"));
|
||||
test.afterEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterEach"));
|
||||
test.beforeAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeAll"));
|
||||
test.afterAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterAll"));
|
||||
test.skip = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "skip"));
|
||||
test.fixme = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fixme"));
|
||||
test.fail = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fail"));
|
||||
test.fail.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "fail.only"));
|
||||
test.slow = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "slow"));
|
||||
test.setTimeout = (0, import_transform.wrapFunctionWithLocation)(this._setTimeout.bind(this));
|
||||
test.step = this._step.bind(this, "pass");
|
||||
test.step.skip = this._step.bind(this, "skip");
|
||||
test.use = (0, import_transform.wrapFunctionWithLocation)(this._use.bind(this));
|
||||
test.extend = (0, import_transform.wrapFunctionWithLocation)(this._extend.bind(this));
|
||||
test.info = () => {
|
||||
const result = (0, import_globals.currentTestInfo)();
|
||||
if (!result)
|
||||
throw new Error("test.info() can only be called while test is running");
|
||||
return result;
|
||||
};
|
||||
this.test = test;
|
||||
}
|
||||
_currentSuite(location, title) {
|
||||
const suite = (0, import_globals.currentlyLoadingFileSuite)();
|
||||
if (!suite) {
|
||||
throw new Error([
|
||||
`Playwright Test did not expect ${title} to be called here.`,
|
||||
`Most common reasons include:`,
|
||||
`- You are calling ${title} in a configuration file.`,
|
||||
`- You are calling ${title} in a file that is imported by the configuration file.`,
|
||||
`- You have two different versions of @playwright/test. This usually happens`,
|
||||
` when one of the dependencies in your package.json depends on @playwright/test.`
|
||||
].join("\n"));
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
_createTest(type, location, title, fnOrDetails, fn) {
|
||||
throwIfRunningInsideJest();
|
||||
const suite = this._currentSuite(location, "test()");
|
||||
if (!suite)
|
||||
return;
|
||||
let details;
|
||||
let body;
|
||||
if (typeof fnOrDetails === "function") {
|
||||
body = fnOrDetails;
|
||||
details = {};
|
||||
} else {
|
||||
body = fn;
|
||||
details = fnOrDetails;
|
||||
}
|
||||
const validatedDetails = (0, import_validators.validateTestDetails)(details, location);
|
||||
const test = new import_test.TestCase(title, body, this, location);
|
||||
test._requireFile = suite._requireFile;
|
||||
test.annotations.push(...validatedDetails.annotations);
|
||||
test._tags.push(...validatedDetails.tags);
|
||||
suite._addTest(test);
|
||||
if (type === "only" || type === "fail.only")
|
||||
test._only = true;
|
||||
if (type === "skip" || type === "fixme" || type === "fail")
|
||||
test.annotations.push({ type, location });
|
||||
else if (type === "fail.only")
|
||||
test.annotations.push({ type: "fail", location });
|
||||
}
|
||||
_describe(type, location, titleOrFn, fnOrDetails, fn) {
|
||||
throwIfRunningInsideJest();
|
||||
const suite = this._currentSuite(location, "test.describe()");
|
||||
if (!suite)
|
||||
return;
|
||||
let title;
|
||||
let body;
|
||||
let details;
|
||||
if (typeof titleOrFn === "function") {
|
||||
title = "";
|
||||
details = {};
|
||||
body = titleOrFn;
|
||||
} else if (typeof fnOrDetails === "function") {
|
||||
title = titleOrFn;
|
||||
details = {};
|
||||
body = fnOrDetails;
|
||||
} else {
|
||||
title = titleOrFn;
|
||||
details = fnOrDetails;
|
||||
body = fn;
|
||||
}
|
||||
const validatedDetails = (0, import_validators.validateTestDetails)(details, location);
|
||||
const child = new import_test.Suite(title, "describe");
|
||||
child._requireFile = suite._requireFile;
|
||||
child.location = location;
|
||||
child._staticAnnotations.push(...validatedDetails.annotations);
|
||||
child._tags.push(...validatedDetails.tags);
|
||||
suite._addSuite(child);
|
||||
if (type === "only" || type === "serial.only" || type === "parallel.only")
|
||||
child._only = true;
|
||||
if (type === "serial" || type === "serial.only")
|
||||
child._parallelMode = "serial";
|
||||
if (type === "parallel" || type === "parallel.only")
|
||||
child._parallelMode = "parallel";
|
||||
if (type === "skip" || type === "fixme")
|
||||
child._staticAnnotations.push({ type, location });
|
||||
for (let parent = suite; parent; parent = parent.parent) {
|
||||
if (parent._parallelMode === "serial" && child._parallelMode === "parallel")
|
||||
throw new Error("describe.parallel cannot be nested inside describe.serial");
|
||||
if (parent._parallelMode === "default" && child._parallelMode === "parallel")
|
||||
throw new Error("describe.parallel cannot be nested inside describe with default mode");
|
||||
}
|
||||
(0, import_globals.setCurrentlyLoadingFileSuite)(child);
|
||||
body();
|
||||
(0, import_globals.setCurrentlyLoadingFileSuite)(suite);
|
||||
}
|
||||
_hook(name, location, title, fn) {
|
||||
const suite = this._currentSuite(location, `test.${name}()`);
|
||||
if (!suite)
|
||||
return;
|
||||
if (typeof title === "function") {
|
||||
fn = title;
|
||||
title = `${name} hook`;
|
||||
}
|
||||
suite._hooks.push({ type: name, fn, title, location });
|
||||
}
|
||||
_configure(location, options) {
|
||||
throwIfRunningInsideJest();
|
||||
const suite = this._currentSuite(location, `test.describe.configure()`);
|
||||
if (!suite)
|
||||
return;
|
||||
if (options.timeout !== void 0)
|
||||
suite._timeout = options.timeout;
|
||||
if (options.retries !== void 0)
|
||||
suite._retries = options.retries;
|
||||
if (options.mode !== void 0) {
|
||||
if (suite._parallelMode !== "none")
|
||||
throw new Error(`"${suite._parallelMode}" mode is already assigned for the enclosing scope.`);
|
||||
suite._parallelMode = options.mode;
|
||||
for (let parent = suite.parent; parent; parent = parent.parent) {
|
||||
if (parent._parallelMode === "serial" && suite._parallelMode === "parallel")
|
||||
throw new Error("describe with parallel mode cannot be nested inside describe with serial mode");
|
||||
if (parent._parallelMode === "default" && suite._parallelMode === "parallel")
|
||||
throw new Error("describe with parallel mode cannot be nested inside describe with default mode");
|
||||
}
|
||||
}
|
||||
}
|
||||
_modifier(type, location, ...modifierArgs) {
|
||||
const suite = (0, import_globals.currentlyLoadingFileSuite)();
|
||||
if (suite) {
|
||||
if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
|
||||
this._createTest(type, location, modifierArgs[0], modifierArgs[1]);
|
||||
return;
|
||||
}
|
||||
if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "object" && typeof modifierArgs[2] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
|
||||
this._createTest(type, location, modifierArgs[0], modifierArgs[1], modifierArgs[2]);
|
||||
return;
|
||||
}
|
||||
if (typeof modifierArgs[0] === "function") {
|
||||
suite._modifiers.push({ type, fn: modifierArgs[0], location, description: modifierArgs[1] });
|
||||
} else {
|
||||
if (modifierArgs.length >= 1 && !modifierArgs[0])
|
||||
return;
|
||||
const description = modifierArgs[1];
|
||||
suite._staticAnnotations.push({ type, description, location });
|
||||
}
|
||||
return;
|
||||
}
|
||||
const testInfo = (0, import_globals.currentTestInfo)();
|
||||
if (!testInfo)
|
||||
throw new Error(`test.${type}() can only be called inside test, describe block or fixture`);
|
||||
if (typeof modifierArgs[0] === "function")
|
||||
throw new Error(`test.${type}() with a function can only be called inside describe block`);
|
||||
testInfo._modifier(type, location, modifierArgs);
|
||||
}
|
||||
_setTimeout(location, timeout) {
|
||||
const suite = (0, import_globals.currentlyLoadingFileSuite)();
|
||||
if (suite) {
|
||||
suite._timeout = timeout;
|
||||
return;
|
||||
}
|
||||
const testInfo = (0, import_globals.currentTestInfo)();
|
||||
if (!testInfo)
|
||||
throw new Error(`test.setTimeout() can only be called from a test`);
|
||||
testInfo.setTimeout(timeout);
|
||||
}
|
||||
_use(location, fixtures) {
|
||||
const suite = this._currentSuite(location, `test.use()`);
|
||||
if (!suite)
|
||||
return;
|
||||
suite._use.push({ fixtures, location });
|
||||
}
|
||||
async _step(expectation, title, body, options = {}) {
|
||||
const testInfo = (0, import_globals.currentTestInfo)();
|
||||
if (!testInfo)
|
||||
throw new Error(`test.step() can only be called from a test`);
|
||||
const step = testInfo._addStep({ category: "test.step", title, location: options.location, box: options.box });
|
||||
return await (0, import_utils.currentZone)().with("stepZone", step).run(async () => {
|
||||
try {
|
||||
let result = void 0;
|
||||
result = await (0, import_utils.raceAgainstDeadline)(async () => {
|
||||
try {
|
||||
return await step.info._runStepBody(expectation === "skip", body, step.location);
|
||||
} catch (e) {
|
||||
if (result?.timedOut)
|
||||
testInfo._failWithError(e);
|
||||
throw e;
|
||||
}
|
||||
}, options.timeout ? (0, import_utils.monotonicTime)() + options.timeout : 0);
|
||||
if (result.timedOut)
|
||||
throw new import_playwright_core.errors.TimeoutError(`Step timeout of ${options.timeout}ms exceeded.`);
|
||||
step.complete({});
|
||||
return result.result;
|
||||
} catch (error) {
|
||||
step.complete({ error });
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
_extend(location, fixtures) {
|
||||
if (fixtures[testTypeSymbol])
|
||||
throw new Error(`test.extend() accepts fixtures object, not a test object.
|
||||
Did you mean to call mergeTests()?`);
|
||||
const fixturesWithLocation = { fixtures, location };
|
||||
return new TestTypeImpl([...this.fixtures, fixturesWithLocation]).test;
|
||||
}
|
||||
}
|
||||
function throwIfRunningInsideJest() {
|
||||
if (process.env.JEST_WORKER_ID) {
|
||||
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
|
||||
throw new Error(
|
||||
`Playwright Test needs to be invoked via '${packageManagerCommand} playwright test' and excluded from Jest test runs.
|
||||
Creating one directory for Playwright tests and one for Jest is the recommended way of doing it.
|
||||
See https://playwright.dev/docs/intro for more information about Playwright Test.`
|
||||
);
|
||||
}
|
||||
}
|
||||
const rootTestType = new TestTypeImpl([]);
|
||||
function mergeTests(...tests) {
|
||||
let result = rootTestType;
|
||||
for (const t of tests) {
|
||||
const testTypeImpl = t[testTypeSymbol];
|
||||
if (!testTypeImpl)
|
||||
throw new Error(`mergeTests() accepts "test" functions as parameters.
|
||||
Did you mean to call test.extend() with fixtures instead?`);
|
||||
const newFixtures = testTypeImpl.fixtures.filter((theirs) => !result.fixtures.find((ours) => ours.fixtures === theirs.fixtures));
|
||||
result = new TestTypeImpl([...result.fixtures, ...newFixtures]);
|
||||
}
|
||||
return result.test;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TestTypeImpl,
|
||||
mergeTests,
|
||||
rootTestType
|
||||
});
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var validators_exports = {};
|
||||
__export(validators_exports, {
|
||||
validateTestAnnotation: () => validateTestAnnotation,
|
||||
validateTestDetails: () => validateTestDetails
|
||||
});
|
||||
module.exports = __toCommonJS(validators_exports);
|
||||
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
||||
const testAnnotationSchema = import_mcpBundle.z.object({
|
||||
type: import_mcpBundle.z.string(),
|
||||
description: import_mcpBundle.z.string().optional()
|
||||
});
|
||||
const testDetailsSchema = import_mcpBundle.z.object({
|
||||
tag: import_mcpBundle.z.union([
|
||||
import_mcpBundle.z.string().optional(),
|
||||
import_mcpBundle.z.array(import_mcpBundle.z.string())
|
||||
]).transform((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : []).refine((val) => val.every((v) => v.startsWith("@")), {
|
||||
message: "Tag must start with '@'"
|
||||
}),
|
||||
annotation: import_mcpBundle.z.union([
|
||||
testAnnotationSchema,
|
||||
import_mcpBundle.z.array(testAnnotationSchema).optional()
|
||||
]).transform((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : [])
|
||||
});
|
||||
function validateTestAnnotation(annotation) {
|
||||
try {
|
||||
return testAnnotationSchema.parse(annotation);
|
||||
} catch (error) {
|
||||
throwZodError(error);
|
||||
}
|
||||
}
|
||||
function validateTestDetails(details, location) {
|
||||
try {
|
||||
const parsedDetails = testDetailsSchema.parse(details);
|
||||
return {
|
||||
annotations: parsedDetails.annotation.map((a) => ({ ...a, location })),
|
||||
tags: parsedDetails.tag,
|
||||
location
|
||||
};
|
||||
} catch (error) {
|
||||
throwZodError(error);
|
||||
}
|
||||
}
|
||||
function throwZodError(error) {
|
||||
throw new Error(error.issues.map((i) => i.message).join("\n"));
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
validateTestAnnotation,
|
||||
validateTestDetails
|
||||
});
|
||||
Reference in new issue
Block a user