@rstest/core
Version:
The Rsbuild-based test tool.
648 lines (647 loc) • 26.3 kB
JavaScript
import 'module';
/*#__PURE__*/ import.meta.url;
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
import * as __rspack_external_node_os_74b4b876 from "node:os";
import * as __rspack_external_node_path_c5b9b54f from "node:path";
import * as __rspack_external_node_tty_c64aab7e from "node:tty";
import { __webpack_require__ } from "./rslib-runtime.js";
__webpack_require__.add({
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
let p = process || {}, argv = p.argv || [], env = p.env || {};
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
let formatter = (open, close, replace = open)=>(input)=>{
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
let replaceClose = (string, close, replace, index)=>{
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
}while (~index);
return result + string.substring(cursor);
};
let createColors = (enabled = isColorSupported)=>{
let f = enabled ? formatter : ()=>String;
return {
isColorSupported: enabled,
reset: f("\x1b[0m", "\x1b[0m"),
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
italic: f("\x1b[3m", "\x1b[23m"),
underline: f("\x1b[4m", "\x1b[24m"),
inverse: f("\x1b[7m", "\x1b[27m"),
hidden: f("\x1b[8m", "\x1b[28m"),
strikethrough: f("\x1b[9m", "\x1b[29m"),
black: f("\x1b[30m", "\x1b[39m"),
red: f("\x1b[31m", "\x1b[39m"),
green: f("\x1b[32m", "\x1b[39m"),
yellow: f("\x1b[33m", "\x1b[39m"),
blue: f("\x1b[34m", "\x1b[39m"),
magenta: f("\x1b[35m", "\x1b[39m"),
cyan: f("\x1b[36m", "\x1b[39m"),
white: f("\x1b[37m", "\x1b[39m"),
gray: f("\x1b[90m", "\x1b[39m"),
bgBlack: f("\x1b[40m", "\x1b[49m"),
bgRed: f("\x1b[41m", "\x1b[49m"),
bgGreen: f("\x1b[42m", "\x1b[49m"),
bgYellow: f("\x1b[43m", "\x1b[49m"),
bgBlue: f("\x1b[44m", "\x1b[49m"),
bgMagenta: f("\x1b[45m", "\x1b[49m"),
bgCyan: f("\x1b[46m", "\x1b[49m"),
bgWhite: f("\x1b[47m", "\x1b[49m"),
blackBright: f("\x1b[90m", "\x1b[39m"),
redBright: f("\x1b[91m", "\x1b[39m"),
greenBright: f("\x1b[92m", "\x1b[39m"),
yellowBright: f("\x1b[93m", "\x1b[39m"),
blueBright: f("\x1b[94m", "\x1b[39m"),
magentaBright: f("\x1b[95m", "\x1b[39m"),
cyanBright: f("\x1b[96m", "\x1b[39m"),
whiteBright: f("\x1b[97m", "\x1b[39m"),
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
bgRedBright: f("\x1b[101m", "\x1b[49m"),
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
};
};
module.exports = createColors();
module.exports.createColors = createColors;
},
fs (module) {
module.exports = __rspack_external_node_fs_5ea92f0c;
},
"node:os" (module) {
module.exports = __rspack_external_node_os_74b4b876;
},
"node:path" (module) {
module.exports = __rspack_external_node_path_c5b9b54f;
},
"node:tty" (module) {
module.exports = __rspack_external_node_tty_c64aab7e;
}
});
let _lazyMatch = ()=>{
var __lib__ = (()=>{
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e)=>{
for(var n in e)m(r, n, {
get: e[n],
enumerable: true
});
}, H = (r, e, n, a)=>{
if (e && "object" == typeof e || "function" == typeof e) for (let t of G(e))T.call(r, t) || t === n || m(r, t, {
get: ()=>e[t],
enumerable: !(a = V(e, t)) || a.enumerable
});
return r;
}, J = (r)=>H(m({}, "__esModule", {
value: true
}), r), w = {};
q(w, {
default: ()=>re
});
var A = (r)=>Array.isArray(r), d = (r)=>"function" == typeof r, Q = (r)=>0 === r.length, W = (r)=>"number" == typeof r, K = (r)=>"object" == typeof r && null !== r, X = (r)=>r instanceof RegExp, b = (r)=>"string" == typeof r, h = (r)=>void 0 === r, Y = (r)=>{
const e = new Map;
return (n)=>{
const a = e.get(n);
if (a) return a;
const t = r(n);
return e.set(n, t), t;
};
}, rr = (r, e, n = {})=>{
const a = {
cache: {},
input: r,
index: 0,
indexMax: 0,
options: n,
output: []
};
if (v(e)(a) && a.index === r.length) return a.output;
throw new Error(`Failed to parse at index ${a.indexMax}`);
}, i = (r, e)=>A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e)=>{
const n = {};
for (const a of r){
if (1 !== a.length) throw new Error(`Invalid character: "${a}"`);
const t = a.charCodeAt(0);
n[t] = true;
}
return (a)=>{
const t = a.index, o = a.input;
for(; a.index < o.length && o.charCodeAt(a.index) in n;)a.index += 1;
const u = a.index;
if (u > t) {
if (!h(e) && !a.options.silent) {
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
h(c) || a.output.push(c);
}
a.indexMax = Math.max(a.indexMax, a.index);
}
return true;
};
}, nr = (r, e)=>{
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
return g((o)=>{
t.lastIndex = o.index;
const u = t.exec(o.input);
if (!u) return false;
if (!h(e) && !o.options.silent) {
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
h(s) || o.output.push(s);
}
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
});
}, ar = (r, e)=>(n)=>{
if (!n.input.startsWith(r, n.index)) return false;
if (!h(e) && !n.options.silent) {
const t = d(e) ? e(r, n.input, String(n.index)) : e;
h(t) || n.output.push(t);
}
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
}, C = (r, e, n, a)=>{
const t = v(r);
return g(_(M((o)=>{
let u = 0;
for(; u < n;){
const s = o.index;
if (!t(o) || (u += 1, o.index === s)) break;
}
return u >= e;
})));
}, tr = (r, e)=>C(r, 0, 1), f = (r, e)=>C(r, 0, 1 / 0), x = (r, e)=>{
const n = r.map(v);
return g(_(M((a)=>{
for(let t = 0, o = n.length; t < o; t++)if (!n[t](a)) return false;
return true;
})));
}, l = (r, e)=>{
const n = r.map(v);
return g(_((a)=>{
for(let t = 0, o = n.length; t < o; t++)if (n[t](a)) return true;
return false;
}));
}, M = (r, e = false)=>{
const n = v(r);
return (a)=>{
const t = a.index, o = a.output.length, u = n(a);
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
};
}, _ = (r, e)=>{
const n = v(r);
return n;
}, g = (()=>{
let r = 0;
return (e)=>{
const n = v(e), a = r += 1;
return (t)=>{
var o;
if (false === t.options.memoization) return n(t);
const u = t.index, s = (o = t.cache)[a] || (o[a] = new Map), c = s.get(u);
if (false === c) return false;
if (W(c)) return t.index = c, true;
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
{
const Z = t.output.length;
if (!n(t)) return s.set(u, false), false;
{
const D = t.index, U = t.output.length;
if (U > Z) {
const ee = t.output.slice(Z, U);
s.set(u, {
index: D,
output: ee
});
} else s.set(u, D);
return true;
}
}
};
};
})(), E = (r)=>{
let e;
return (n)=>(e || (e = v(r())), e(n));
}, v = Y((r)=>{
if (d(r)) return Q(r) ? E(r) : r;
if (b(r) || X(r)) return i(r);
if (A(r)) return x(r);
if (K(r)) return l(Object.values(r));
throw new Error("Invalid rule");
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r)=>{
let e = "";
for(; r > 0;){
const n = (r - 1) % 26;
e = P[n] + e, r = Math.floor((r - 1) / 26);
}
return e;
}, O = (r)=>{
let e = 0;
for(let n = 0, a = r.length; n < a; n++)e = 26 * e + P.indexOf(r[n]) + 1;
return e;
}, S = (r, e)=>{
if (e < r) return S(e, r);
const n = [];
for(; r <= e;)n.push(r++);
return n;
}, or = (r, e, n)=>S(r, e).map((a)=>String(a).padStart(n, "0")), R = (r, e)=>S(O(r), O(e)).map(ir), p = (r)=>r, z = (r)=>ur((e)=>rr(e, r, {
memoization: false
}).join("")), ur = (r)=>{
const e = {};
return (n)=>e[n] ?? (e[n] = r(n));
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n)=>`.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a)=>`.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r)=>`\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e)=>`(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([
hr,
dr
]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([
xr,
gr,
mr,
_r
]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([
Sr,
yr
]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r)=>`\\${r}`), Mr = i(/[^\]]/, p), Er = l([
y,
Cr,
br,
Mr
]), B = x([
$r,
tr(Ar),
f(Er),
wr
]), Pr = i("{", "(?:"), Or = i("}", ")"), Rr = i(/(\d+)\.\.(\d+)/, (r, e, n)=>or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n)=>R(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n)=>R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([
Rr,
zr,
jr
]), I = x([
Pr,
Nr,
Or
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r)=>`\\${r}`), Lr = i(/[^}]/, p), Zr = E(()=>F), Dr = l([
j,
N,
k,
B,
I,
Zr,
y,
Fr,
Ir,
Lr
]), F = x([
kr,
f(Dr),
Br
]), Ur = f(l([
sr,
cr,
lr,
fr,
j,
N,
k,
B,
I,
F,
y,
pr,
vr
])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e)=>`${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e)=>`${e}*`), Wr = f(l([
Tr,
Hr,
Jr,
Qr,
qr
])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e)=>{
const n = Array.isArray(r) ? r : [
r
];
if (!n.length) return false;
const a = n.map($.compile), t = n.every((s)=>/(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
return a.some((s)=>s.test(o));
};
$.compile = (r)=>new RegExp(`^${L(Yr(r))}$`, "s");
var re = $;
return J(w);
})();
return __lib__.default || __lib__;
};
let _match;
const zeptomatch = (path, pattern)=>{
if (!_match) {
_match = _lazyMatch();
_lazyMatch = null;
}
return _match(path, pattern);
};
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
function normalizeWindowsPath(input = "") {
if (!input) return input;
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r)=>r.toUpperCase());
}
const _UNC_REGEX = /^[/\\]{2}/;
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
const sep = "/";
const normalize = function(path) {
if (0 === path.length) return ".";
path = normalizeWindowsPath(path);
const isUNCPath = path.match(_UNC_REGEX);
const isPathAbsolute = isAbsolute(path);
const trailingSeparator = "/" === path[path.length - 1];
path = normalizeString(path, !isPathAbsolute);
if (0 === path.length) {
if (isPathAbsolute) return "/";
return trailingSeparator ? "./" : ".";
}
if (trailingSeparator) path += "/";
if (_DRIVE_LETTER_RE.test(path)) path += "/";
if (isUNCPath) {
if (!isPathAbsolute) return `//./${path}`;
return `//${path}`;
}
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
};
const join = function(...segments) {
let path = "";
for (const seg of segments)if (seg) if (path.length > 0) {
const pathTrailing = "/" === path[path.length - 1];
const segLeading = "/" === seg[0];
const both = pathTrailing && segLeading;
if (both) path += seg.slice(1);
else path += pathTrailing || segLeading ? seg : `/${seg}`;
} else path += seg;
return normalize(path);
};
function cwd() {
if ("u" > typeof process && "function" == typeof process.cwd) return process.cwd().replace(/\\/g, "/");
return "/";
}
const resolve = function(...arguments_) {
arguments_ = arguments_.map((argument)=>normalizeWindowsPath(argument));
let resolvedPath = "";
let resolvedAbsolute = false;
for(let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--){
const path = index >= 0 ? arguments_[index] : cwd();
if (path && 0 !== path.length) {
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = isAbsolute(path);
}
}
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
return resolvedPath.length > 0 ? resolvedPath : ".";
};
function normalizeString(path, allowAboveRoot) {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let char = null;
for(let index = 0; index <= path.length; ++index){
if (index < path.length) char = path[index];
else if ("/" === char) break;
else char = "/";
if ("/" === char) {
if (lastSlash === index - 1 || 1 === dots) ;
else if (2 === dots) {
if (res.length < 2 || 2 !== lastSegmentLength || "." !== res[res.length - 1] || "." !== res[res.length - 2]) {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf("/");
if (-1 === lastSlashIndex) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
}
lastSlash = index;
dots = 0;
continue;
} else if (res.length > 0) {
res = "";
lastSegmentLength = 0;
lastSlash = index;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
res += res.length > 0 ? "/.." : "..";
lastSegmentLength = 2;
}
} else {
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
else res = path.slice(lastSlash + 1, index);
lastSegmentLength = index - lastSlash - 1;
}
lastSlash = index;
dots = 0;
} else if ("." === char && -1 !== dots) ++dots;
else dots = -1;
}
return res;
}
const isAbsolute = function(p) {
return _IS_ABSOLUTE_RE.test(p);
};
const toNamespacedPath = function(p) {
return normalizeWindowsPath(p);
};
const extname = function(p) {
if (".." === p) return "";
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
return match && match[1] || "";
};
const relative = function(from, to) {
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
if (":" === _to[0][1] && ":" === _from[0][1] && _from[0] !== _to[0]) return _to.join("/");
const _fromCopy = [
..._from
];
for (const segment of _fromCopy){
if (_to[0] !== segment) break;
_from.shift();
_to.shift();
}
return [
..._from.map(()=>".."),
..._to
].join("/");
};
const dirname = function(p) {
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
if (1 === segments.length && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
const format = function(p) {
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
const segments = [
p.root,
p.dir,
p.base ?? (p.name ?? "") + ext
].filter(Boolean);
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
};
const basename = function(p, extension) {
const segments = normalizeWindowsPath(p).split("/");
let lastSegment = "";
for(let i = segments.length - 1; i >= 0; i--){
const val = segments[i];
if (val) {
lastSegment = val;
break;
}
}
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
};
const parse = function(p) {
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
const base = basename(p);
const extension = extname(base);
return {
root,
dir: dirname(p),
base,
ext: extension,
name: base.slice(0, base.length - extension.length)
};
};
const matchesGlob = (path, pattern)=>zeptomatch(pattern, normalize(path));
const _path = {
__proto__: null,
basename: basename,
dirname: dirname,
extname: extname,
format: format,
isAbsolute: isAbsolute,
join: join,
matchesGlob: matchesGlob,
normalize: normalize,
normalizeString: normalizeString,
parse: parse,
relative: relative,
resolve: resolve,
sep: sep,
toNamespacedPath: toNamespacedPath
};
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', normalize(root));
function getAbsolutePath(base, filepath) {
return isAbsolute(filepath) ? filepath : join(base, filepath);
}
const parsePosix = (filePath)=>{
const { dir, base } = parse(filePath);
return {
dir: dir.split("/").join('/'),
base
};
};
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
const castArray = (arr)=>{
if (void 0 === arr) return [];
return Array.isArray(arr) ? arr : [
arr
];
};
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype;
function formatError(error) {
if ('string' == typeof error || error instanceof Error) return error;
if (isPlainObject(error) && error.message) {
const e = new Error(error.name || 'unknown error');
e.message = error.message;
e.stack = error.stack;
return e;
}
return String(error);
}
const prettyTime = (milliseconds)=>{
if (milliseconds < 1000) return `${Math.round(milliseconds)}ms`;
const seconds = milliseconds / 1000;
const getSecond = (seconds, needDigits)=>{
if (!needDigits || seconds === Math.ceil(seconds)) return `${Math.round(seconds).toString()}s`;
const digits = seconds < 10 ? seconds >= 0.01 ? 2 : 3 : 1;
return `${seconds.toFixed(digits)}s`;
};
const minutes = Math.floor(seconds / 60);
const secondsRemainder = seconds % 60;
let time = '';
if (minutes > 0) time += `${minutes}m`;
if (secondsRemainder > 0) {
if (minutes > 0) time += ' ';
time += getSecond(secondsRemainder, !minutes);
}
return time;
};
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
const unwrapRegex = (value)=>{
if (value.startsWith(REGEXP_FLAG_PREFIX)) {
const regexStr = value.slice(REGEXP_FLAG_PREFIX.length);
const matches = regexStr.match(/^\/(.+)\/([gimuy]*)$/);
if (matches) {
const [, pattern, flags] = matches;
return new RegExp(pattern, flags);
}
}
return value;
};
const serializableConfig = (normalizedConfig)=>{
const { testNamePattern } = normalizedConfig;
return {
...normalizedConfig,
testNamePattern: testNamePattern && 'string' != typeof testNamePattern ? wrapRegex(testNamePattern) : testNamePattern
};
};
const undoSerializableConfig = (normalizedConfig)=>{
const { testNamePattern } = normalizedConfig;
return {
...normalizedConfig,
testNamePattern: testNamePattern && 'string' == typeof testNamePattern ? unwrapRegex(testNamePattern) : testNamePattern
};
};
const getNodeVersion = ()=>{
if ('string' == typeof process.versions?.node) {
const [major = 0, minor = 0, patch = 0] = process.versions.node.split('.').map(Number);
return {
major,
minor,
patch
};
}
return {
major: 0,
minor: 0,
patch: 0
};
};
const needFlagExperimentalDetectModule = ()=>{
const { major, minor } = getNodeVersion();
if (20 === major && minor >= 10) return true;
if (22 === major && minor < 7) return true;
return false;
};
const ADDITIONAL_NODE_BUILTINS = [
/^node:/,
'pnpapi'
];
const bgColor = (background, str)=>{
if ([
'bgRed',
'bgBlack'
].includes(background)) return picocolors_default()[background](picocolors_default().white(picocolors_default().bold(str)));
return picocolors_default()[background](picocolors_default().blackBright(picocolors_default().bold(str)));
};
const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
const isDeno = "u" > typeof process && process.versions?.deno !== void 0;
export { ADDITIONAL_NODE_BUILTINS, _path, basename, bgColor, castArray, dirname, formatError, formatRootStr, getAbsolutePath, getTaskNameWithPrefix, isAbsolute, isDeno, isObject, isTTY, join, needFlagExperimentalDetectModule, normalize, parsePosix, prettyTime, relative, resolve, serializableConfig, undoSerializableConfig };