Aktueller Stand
This commit is contained in:
96
backend/node_modules/@prisma/get-platform/dist/test-utils/jestSnapshotSerializer.js
generated
vendored
96
backend/node_modules/@prisma/get-platform/dist/test-utils/jestSnapshotSerializer.js
generated
vendored
@@ -21,74 +21,14 @@ __export(jestSnapshotSerializer_exports, {
|
||||
default: () => jestSnapshotSerializer_default
|
||||
});
|
||||
module.exports = __toCommonJS(jestSnapshotSerializer_exports);
|
||||
var import_chunk_B23KD6U3 = require("../chunk-B23KD6U3.js");
|
||||
var import_chunk_IPLRRT6O = require("../chunk-IPLRRT6O.js");
|
||||
var import_chunk_7MLUNQIZ = require("../chunk-7MLUNQIZ.js");
|
||||
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
||||
var require_replace_string = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
"../../node_modules/.pnpm/replace-string@3.1.0/node_modules/replace-string/index.js"(exports, module2) {
|
||||
"use strict";
|
||||
module2.exports = (string, needle, replacement, options = {}) => {
|
||||
if (typeof string !== "string") {
|
||||
throw new TypeError(`Expected input to be a string, got ${typeof string}`);
|
||||
}
|
||||
if (!(typeof needle === "string" && needle.length > 0) || !(typeof replacement === "string" || typeof replacement === "function")) {
|
||||
return string;
|
||||
}
|
||||
let result = "";
|
||||
let matchCount = 0;
|
||||
let prevIndex = options.fromIndex > 0 ? options.fromIndex : 0;
|
||||
if (prevIndex > string.length) {
|
||||
return string;
|
||||
}
|
||||
while (true) {
|
||||
const index = options.caseInsensitive ? string.toLowerCase().indexOf(needle.toLowerCase(), prevIndex) : string.indexOf(needle, prevIndex);
|
||||
if (index === -1) {
|
||||
break;
|
||||
}
|
||||
matchCount++;
|
||||
const replaceStr = typeof replacement === "string" ? replacement : replacement(
|
||||
// If `caseInsensitive`` is enabled, the matched substring may be different from the needle.
|
||||
string.slice(index, index + needle.length),
|
||||
matchCount,
|
||||
string,
|
||||
index
|
||||
);
|
||||
const beginSlice = matchCount === 1 ? 0 : prevIndex;
|
||||
result += string.slice(beginSlice, index) + replaceStr;
|
||||
prevIndex = index + needle.length;
|
||||
}
|
||||
if (matchCount === 0) {
|
||||
return string;
|
||||
}
|
||||
return result + string.slice(prevIndex);
|
||||
};
|
||||
}
|
||||
});
|
||||
var require_ansi_regex = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
"../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module2) {
|
||||
"use strict";
|
||||
module2.exports = ({ onlyFirst = false } = {}) => {
|
||||
const pattern = [
|
||||
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
||||
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
||||
].join("|");
|
||||
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
||||
};
|
||||
}
|
||||
});
|
||||
var require_strip_ansi = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
"../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module2) {
|
||||
"use strict";
|
||||
var ansiRegex = require_ansi_regex();
|
||||
module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
|
||||
}
|
||||
});
|
||||
var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
"src/test-utils/jestSnapshotSerializer.js"(exports, module2) {
|
||||
var path = (0, import_chunk_2ESYSVXG.__require)("path");
|
||||
var replaceAll = require_replace_string();
|
||||
var stripAnsi = require_strip_ansi();
|
||||
var { binaryTargetRegex } = ((0, import_chunk_B23KD6U3.init_binaryTargetRegex)(), (0, import_chunk_2ESYSVXG.__toCommonJS)(import_chunk_B23KD6U3.binaryTargetRegex_exports));
|
||||
var path = (0, import_chunk_2ESYSVXG.__require)("node:path");
|
||||
var { stripVTControlCharacters } = (0, import_chunk_2ESYSVXG.__require)("node:util");
|
||||
var { binaryTargetRegex } = ((0, import_chunk_IPLRRT6O.init_binaryTargetRegex)(), (0, import_chunk_2ESYSVXG.__toCommonJS)(import_chunk_IPLRRT6O.binaryTargetRegex_exports));
|
||||
var pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
|
||||
function normalizePrismaPaths(str) {
|
||||
return str.replace(/prisma\\([\w-]+)\.prisma/g, "prisma/$1.prisma").replace(/prisma\\seed\.ts/g, "prisma/seed.ts").replace(/custom-folder\\seed\.js/g, "custom-folder/seed.js");
|
||||
@@ -100,14 +40,27 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
).replace(/Starting a postgresql pool with \d+ connections./g, "Starting a postgresql pool with XX connections.");
|
||||
}
|
||||
function normalizeTmpDir(str) {
|
||||
return str.replace(/\/tmp\/([a-z0-9]+)\//g, "/tmp/dir/");
|
||||
const tempDirRegexes = [
|
||||
// Linux
|
||||
/\/tmp\/([a-z0-9]+)/g,
|
||||
// macOS
|
||||
/\/private\/var\/folders\/[^/]+\/[^/]+\/T\/[a-z0-9]+/g
|
||||
];
|
||||
if (process.env.TEMP) {
|
||||
const escapedPath = process.env.TEMP.replaceAll("\\", "\\\\");
|
||||
tempDirRegexes.push(new RegExp(`${escapedPath}\\\\[a-z0-9]+`, "g"));
|
||||
}
|
||||
for (const regex of tempDirRegexes) {
|
||||
str = str.replace(regex, "/tmp/dir");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function trimErrorPaths(str) {
|
||||
const parentDir = path.dirname(path.dirname(path.dirname(__dirname)));
|
||||
return replaceAll(str, parentDir, "");
|
||||
return str.replaceAll(parentDir, "");
|
||||
}
|
||||
function normalizeToUnixPaths(str) {
|
||||
return replaceAll(str, path.sep, "/");
|
||||
return str.replaceAll(path.sep, "/");
|
||||
}
|
||||
function normalizeGitHubLinks(str) {
|
||||
return str.replace(/https:\/\/github.com\/prisma\/prisma(-client-js)?\/issues\/new\S+/, "TEST_GITHUB_LINK");
|
||||
@@ -118,12 +71,6 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
function removePlatforms(str) {
|
||||
return str.replace(binaryTargetRegex, "TEST_PLATFORM");
|
||||
}
|
||||
function normalizeNodeApiLibFilePath(str) {
|
||||
return str.replace(
|
||||
/((lib)?query_engine-TEST_PLATFORM\.)(.*)(\.node)/g,
|
||||
"libquery_engine-TEST_PLATFORM.LIBRARY_TYPE.node"
|
||||
);
|
||||
}
|
||||
function normalizeBinaryFilePath(str) {
|
||||
return str.replace(/\.exe(\s+)?(\W.*)/g, "$1$2").replace(/\.exe$/g, "");
|
||||
}
|
||||
@@ -172,7 +119,7 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
serialize(value) {
|
||||
const message = typeof value === "string" ? value : value instanceof Error ? value.message : "";
|
||||
return pipe(
|
||||
stripAnsi,
|
||||
stripVTControlCharacters,
|
||||
// integration-tests pkg
|
||||
prepareSchemaForSnapshot,
|
||||
// Generic
|
||||
@@ -181,7 +128,6 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
|
||||
// From Client package
|
||||
normalizeGitHubLinks,
|
||||
removePlatforms,
|
||||
normalizeNodeApiLibFilePath,
|
||||
normalizeBinaryFilePath,
|
||||
normalizeTsClientStackTrace,
|
||||
trimErrorPaths,
|
||||
|
||||
Reference in New Issue
Block a user