wip:milestone 0 fixes
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped

This commit is contained in:
2026-03-15 12:35:42 +02:00
parent 6708cf28a7
commit cffdf8af86
61266 changed files with 4511646 additions and 1938 deletions

1530
control-plane-ui/node_modules/vitest/LICENSE.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

7
control-plane-ui/node_modules/vitest/README.md generated vendored Normal file
View File

@@ -0,0 +1,7 @@
# vitest
[![NPM version](https://img.shields.io/npm/v/vitest?color=a1b858&label=)](https://www.npmjs.com/package/vitest)
Next generation testing framework powered by Vite.
[GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/)

1
control-plane-ui/node_modules/vitest/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/browser.js'

1
control-plane-ui/node_modules/vitest/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/config.js'

1
control-plane-ui/node_modules/vitest/coverage.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/coverage.js'

60
control-plane-ui/node_modules/vitest/dist/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
export { processError, startTests } from '@vitest/runner';
import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-w_64AS5f.js';
import { VitestExecutor } from './execute.js';
import 'vite';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
import 'node:vm';
type Formatter = (input: string | number | null | undefined) => string;
interface DiffOptions {
aAnnotation?: string;
aColor?: Formatter;
aIndicator?: string;
bAnnotation?: string;
bColor?: Formatter;
bIndicator?: string;
changeColor?: Formatter;
changeLineTrailingSpaceColor?: Formatter;
commonColor?: Formatter;
commonIndicator?: string;
commonLineTrailingSpaceColor?: Formatter;
contextLines?: number;
emptyFirstOrLastLinePlaceholder?: string;
expand?: boolean;
includeChangeCounts?: boolean;
omitAnnotationLines?: boolean;
patchColor?: Formatter;
compareKeys?: any;
truncateThreshold?: number;
truncateAnnotation?: string;
truncateAnnotationColor?: Formatter;
}
declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
declare function loadDiffConfig(config: ResolvedConfig, executor: VitestExecutor): Promise<DiffOptions | undefined>;
declare function loadSnapshotSerializers(config: ResolvedConfig, executor: VitestExecutor): Promise<void>;
interface Loader {
executeId: (id: string) => Promise<{
default: CoverageProviderModule;
}>;
}
declare function getCoverageProvider(options: CoverageOptions | undefined, loader: Loader): Promise<CoverageProvider | null>;
declare function startCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
declare function takeCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
declare function stopCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };

7
control-plane-ui/node_modules/vitest/dist/browser.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export { processError, startTests } from '@vitest/runner';
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.8nJLd4ay.js';
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
import '@vitest/utils';
import '@vitest/snapshot';
import './vendor/run-once.Olz_Zkd8.js';
import './vendor/global.CkGT_TMy.js';

View File

@@ -0,0 +1,19 @@
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
import 'pathe';
import '@vitest/runner/utils';
import '@vitest/utils';
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
getHeader() {
return `// Vitest Snapshot v${this.getVersion()}, https://vitest.dev/guide/snapshot.html`;
}
resolvePath(filepath) {
const rpc = getWorkerState().rpc;
return rpc.resolveSnapshotPath(filepath);
}
}
export { VitestNodeSnapshotEnvironment };

View File

@@ -0,0 +1,319 @@
import require$$0, { promises } from 'fs';
import p from 'path';
import process from 'process';
import { fileURLToPath } from 'url';
import { execa } from 'execa';
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
var __privateWrapper = (obj, member, setter, getter) => ({
set _(value) {
__privateSet(obj, member, value, setter);
},
get _() {
return __privateGet(obj, member, getter);
}
});
// node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
var Node = class {
constructor(value) {
__publicField(this, "value");
__publicField(this, "next");
this.value = value;
}
};
var _head, _tail, _size;
var Queue = class {
constructor() {
__privateAdd(this, _head, void 0);
__privateAdd(this, _tail, void 0);
__privateAdd(this, _size, void 0);
this.clear();
}
enqueue(value) {
const node = new Node(value);
if (__privateGet(this, _head)) {
__privateGet(this, _tail).next = node;
__privateSet(this, _tail, node);
} else {
__privateSet(this, _head, node);
__privateSet(this, _tail, node);
}
__privateWrapper(this, _size)._++;
}
dequeue() {
const current = __privateGet(this, _head);
if (!current) {
return;
}
__privateSet(this, _head, __privateGet(this, _head).next);
__privateWrapper(this, _size)._--;
return current.value;
}
clear() {
__privateSet(this, _head, void 0);
__privateSet(this, _tail, void 0);
__privateSet(this, _size, 0);
}
get size() {
return __privateGet(this, _size);
}
*[Symbol.iterator]() {
let current = __privateGet(this, _head);
while (current) {
yield current.value;
current = current.next;
}
}
};
_head = new WeakMap();
_tail = new WeakMap();
_size = new WeakMap();
// node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
function pLimit(concurrency) {
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
}
const queue = new Queue();
let activeCount = 0;
const next = () => {
activeCount--;
if (queue.size > 0) {
queue.dequeue()();
}
};
const run = async (fn, resolve, args) => {
activeCount++;
const result = (async () => fn(...args))();
resolve(result);
try {
await result;
} catch {
}
next();
};
const enqueue = (fn, resolve, args) => {
queue.enqueue(run.bind(void 0, fn, resolve, args));
(async () => {
await Promise.resolve();
if (activeCount < concurrency && queue.size > 0) {
queue.dequeue()();
}
})();
};
const generator = (fn, ...args) => new Promise((resolve) => {
enqueue(fn, resolve, args);
});
Object.defineProperties(generator, {
activeCount: {
get: () => activeCount
},
pendingCount: {
get: () => queue.size
},
clearQueue: {
value: () => {
queue.clear();
}
}
});
return generator;
}
// node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
var EndError = class extends Error {
constructor(value) {
super();
this.value = value;
}
};
var testElement = async (element, tester) => tester(await element);
var finder = async (element) => {
const values = await Promise.all(element);
if (values[1] === true) {
throw new EndError(values[0]);
}
return false;
};
async function pLocate(iterable, tester, {
concurrency = Number.POSITIVE_INFINITY,
preserveOrder = true
} = {}) {
const limit = pLimit(concurrency);
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
try {
await Promise.all(items.map((element) => checkLimit(finder, element)));
} catch (error) {
if (error instanceof EndError) {
return error.value;
}
throw error;
}
}
// node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
var typeMappings = {
directory: "isDirectory",
file: "isFile"
};
function checkType(type) {
if (Object.hasOwnProperty.call(typeMappings, type)) {
return;
}
throw new Error(`Invalid type specified: ${type}`);
}
var matchType = (type, stat) => stat[typeMappings[type]]();
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
async function locatePath(paths, {
cwd = process.cwd(),
type = "file",
allowSymlinks = true,
concurrency,
preserveOrder
} = {}) {
checkType(type);
cwd = toPath(cwd);
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
return pLocate(paths, async (path_) => {
try {
const stat = await statFunction(p.resolve(cwd, path_));
return matchType(type, stat);
} catch {
return false;
}
}, { concurrency, preserveOrder });
}
function toPath2(urlOrPath) {
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
}
// node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
var findUpStop = Symbol("findUpStop");
async function findUpMultiple(name, options = {}) {
let directory = p.resolve(toPath2(options.cwd) ?? "");
const { root } = p.parse(directory);
const stopAt = p.resolve(directory, toPath2(options.stopAt ?? root));
const limit = options.limit ?? Number.POSITIVE_INFINITY;
const paths = [name].flat();
const runMatcher = async (locateOptions) => {
if (typeof name !== "function") {
return locatePath(paths, locateOptions);
}
const foundPath = await name(locateOptions.cwd);
if (typeof foundPath === "string") {
return locatePath([foundPath], locateOptions);
}
return foundPath;
};
const matches = [];
while (true) {
const foundPath = await runMatcher({ ...options, cwd: directory });
if (foundPath === findUpStop) {
break;
}
if (foundPath) {
matches.push(p.resolve(directory, foundPath));
}
if (directory === stopAt || matches.length >= limit) {
break;
}
directory = p.dirname(directory);
}
return matches;
}
async function findUp(name, options = {}) {
const matches = await findUpMultiple(name, { ...options, limit: 1 });
return matches[0];
}
// src/detect.ts
var AGENTS = ["pnpm", "yarn", "npm", "pnpm@6", "yarn@berry", "bun"];
var LOCKS = {
"bun.lockb": "bun",
"pnpm-lock.yaml": "pnpm",
"yarn.lock": "yarn",
"package-lock.json": "npm",
"npm-shrinkwrap.json": "npm"
};
async function detectPackageManager(cwd = process.cwd()) {
let agent = null;
const lockPath = await findUp(Object.keys(LOCKS), { cwd });
let packageJsonPath;
if (lockPath)
packageJsonPath = p.resolve(lockPath, "../package.json");
else
packageJsonPath = await findUp("package.json", { cwd });
if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
try {
const pkg = JSON.parse(require$$0.readFileSync(packageJsonPath, "utf8"));
if (typeof pkg.packageManager === "string") {
const [name, version] = pkg.packageManager.split("@");
if (name === "yarn" && Number.parseInt(version) > 1)
agent = "yarn@berry";
else if (name === "pnpm" && Number.parseInt(version) < 7)
agent = "pnpm@6";
else if (AGENTS.includes(name))
agent = name;
else
console.warn("[ni] Unknown packageManager:", pkg.packageManager);
}
} catch {
}
}
if (!agent && lockPath)
agent = LOCKS[p.basename(lockPath)];
return agent;
}
async function installPackage(names, options = {}) {
const detectedAgent = options.packageManager || await detectPackageManager(options.cwd) || "npm";
const [agent] = detectedAgent.split("@");
if (!Array.isArray(names))
names = [names];
const args = options.additionalArgs || [];
if (options.preferOffline) {
if (detectedAgent === "yarn@berry")
args.unshift("--cached");
else
args.unshift("--prefer-offline");
}
return execa(
agent,
[
agent === "yarn" ? "add" : "install",
options.dev ? "-D" : "",
...args,
...names
].filter(Boolean),
{
stdio: options.silent ? "ignore" : "inherit",
cwd: options.cwd
}
);
}
export { detectPackageManager, installPackage };

View File

@@ -0,0 +1,31 @@
import { g as globalApis } from '../vendor/constants.5J7I254_.js';
import { V as VitestIndex } from '../vendor/index.dI9lHwVn.js';
import '@vitest/runner';
import '../vendor/benchmark.yGkUTKnC.js';
import '@vitest/runner/utils';
import '@vitest/utils';
import '../vendor/index.SMVOaj7F.js';
import 'pathe';
import '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
import '../vendor/run-once.Olz_Zkd8.js';
import '../vendor/vi.YFlodzP_.js';
import 'chai';
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
import '@vitest/expect';
import '@vitest/snapshot';
import '@vitest/utils/error';
import '../vendor/tasks.IknbGB2n.js';
import '@vitest/utils/source-map';
import '../vendor/base.5NT-gWu5.js';
import '../vendor/date.Ns1pGd_X.js';
import '@vitest/spy';
function registerApiGlobally() {
globalApis.forEach((api) => {
globalThis[api] = VitestIndex[api];
});
}
export { registerApiGlobally };

View File

@@ -0,0 +1,70 @@
import { resolve } from 'pathe';
import { execa } from 'execa';
class VitestGit {
constructor(cwd) {
this.cwd = cwd;
}
root;
async resolveFilesWithGitCommand(args) {
let result;
try {
result = await execa("git", args, { cwd: this.root });
} catch (e) {
e.message = e.stderr;
throw e;
}
return result.stdout.split("\n").filter((s) => s !== "").map((changedPath) => resolve(this.root, changedPath));
}
async findChangedFiles(options) {
const root = await this.getRoot(this.cwd);
if (!root)
return null;
this.root = root;
const changedSince = options.changedSince;
if (typeof changedSince === "string") {
const [committed, staged2, unstaged2] = await Promise.all([
this.getFilesSince(changedSince),
this.getStagedFiles(),
this.getUnstagedFiles()
]);
return [...committed, ...staged2, ...unstaged2];
}
const [staged, unstaged] = await Promise.all([
this.getStagedFiles(),
this.getUnstagedFiles()
]);
return [...staged, ...unstaged];
}
getFilesSince(hash) {
return this.resolveFilesWithGitCommand(
["diff", "--name-only", `${hash}...HEAD`]
);
}
getStagedFiles() {
return this.resolveFilesWithGitCommand(
["diff", "--cached", "--name-only"]
);
}
getUnstagedFiles() {
return this.resolveFilesWithGitCommand(
[
"ls-files",
"--other",
"--modified",
"--exclude-standard"
]
);
}
async getRoot(cwd) {
const options = ["rev-parse", "--show-cdup"];
try {
const result = await execa("git", options, { cwd });
return resolve(cwd, result.stdout);
} catch {
return null;
}
}
}
export { VitestGit };

View File

@@ -0,0 +1,131 @@
import { Writable } from 'node:stream';
import { Console } from 'node:console';
import { relative } from 'node:path';
import { getSafeTimers, getColors } from '@vitest/utils';
import { R as RealDate } from '../vendor/date.Ns1pGd_X.js';
import 'pathe';
import '@vitest/runner/utils';
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
function getTaskIdByStack(root) {
var _a, _b;
const stack = (_a = new Error("STACK_TRACE_ERROR").stack) == null ? void 0 : _a.split("\n");
if (!stack)
return UNKNOWN_TEST_ID;
const index = stack.findIndex((line2) => line2.includes("at Console.value"));
const line = index === -1 ? null : stack[index + 2];
if (!line)
return UNKNOWN_TEST_ID;
const filepath = (_b = line.match(/at\s(.*)\s?/)) == null ? void 0 : _b[1];
if (filepath)
return relative(root, filepath);
return UNKNOWN_TEST_ID;
}
function createCustomConsole() {
const stdoutBuffer = /* @__PURE__ */ new Map();
const stderrBuffer = /* @__PURE__ */ new Map();
const timers = /* @__PURE__ */ new Map();
const { setTimeout, clearTimeout } = getSafeTimers();
const state = () => getWorkerState();
function schedule(taskId) {
const timer = timers.get(taskId);
const { stdoutTime, stderrTime } = timer;
clearTimeout(timer.timer);
timer.timer = setTimeout(() => {
if (stderrTime < stdoutTime) {
sendStderr(taskId);
sendStdout(taskId);
} else {
sendStdout(taskId);
sendStderr(taskId);
}
});
}
function sendStdout(taskId) {
const buffer = stdoutBuffer.get(taskId);
if (!buffer)
return;
const content = buffer.map((i) => String(i)).join("");
const timer = timers.get(taskId);
state().rpc.onUserConsoleLog({
type: "stdout",
content: content || "<empty line>",
taskId,
time: timer.stdoutTime || RealDate.now(),
size: buffer.length
});
stdoutBuffer.set(taskId, []);
timer.stdoutTime = 0;
}
function sendStderr(taskId) {
const buffer = stderrBuffer.get(taskId);
if (!buffer)
return;
const content = buffer.map((i) => String(i)).join("");
const timer = timers.get(taskId);
state().rpc.onUserConsoleLog({
type: "stderr",
content: content || "<empty line>",
taskId,
time: timer.stderrTime || RealDate.now(),
size: buffer.length
});
stderrBuffer.set(taskId, []);
timer.stderrTime = 0;
}
const stdout = new Writable({
write(data, encoding, callback) {
var _a, _b, _c;
const s = state();
const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
let timer = timers.get(id);
if (timer) {
timer.stdoutTime = timer.stdoutTime || RealDate.now();
} else {
timer = { stdoutTime: RealDate.now(), stderrTime: RealDate.now(), timer: 0 };
timers.set(id, timer);
}
let buffer = stdoutBuffer.get(id);
if (!buffer) {
buffer = [];
stdoutBuffer.set(id, buffer);
}
buffer.push(data);
schedule(id);
callback();
}
});
const stderr = new Writable({
write(data, encoding, callback) {
var _a, _b, _c;
const s = state();
const id = ((_a = s == null ? void 0 : s.current) == null ? void 0 : _a.id) || ((_c = (_b = s == null ? void 0 : s.current) == null ? void 0 : _b.file) == null ? void 0 : _c.id) || getTaskIdByStack(s.config.root);
let timer = timers.get(id);
if (timer) {
timer.stderrTime = timer.stderrTime || RealDate.now();
} else {
timer = { stderrTime: RealDate.now(), stdoutTime: RealDate.now(), timer: 0 };
timers.set(id, timer);
}
let buffer = stderrBuffer.get(id);
if (!buffer) {
buffer = [];
stderrBuffer.set(id, buffer);
}
buffer.push(data);
schedule(id);
callback();
}
});
return new Console({
stdout,
stderr,
colorMode: getColors().isColorSupported,
groupIndentation: 2
});
}
export { UNKNOWN_TEST_ID, createCustomConsole };

View File

@@ -0,0 +1,125 @@
import { performance } from 'node:perf_hooks';
import { startTests } from '@vitest/runner';
import 'pathe';
import '@vitest/runner/utils';
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.YFlodzP_.js';
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.DpVgvm2P.js';
import { createRequire } from 'node:module';
import util from 'node:util';
import timers from 'node:timers';
import { isatty } from 'node:tty';
import { installSourcemapsSupport } from 'vite-node/source-map';
import { V as VitestIndex } from '../vendor/index.dI9lHwVn.js';
import { s as setupCommonEnv } from '../vendor/setup-common.8nJLd4ay.js';
import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
import 'std-env';
import 'chai';
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
import '@vitest/expect';
import '@vitest/snapshot';
import '@vitest/utils/error';
import '../vendor/tasks.IknbGB2n.js';
import '@vitest/utils/source-map';
import '../vendor/base.5NT-gWu5.js';
import '../vendor/date.Ns1pGd_X.js';
import '@vitest/spy';
import '../path.js';
import 'node:url';
import '../vendor/rpc.joBhAkyK.js';
import '../vendor/index.8bPxjt7g.js';
import '../vendor/benchmark.yGkUTKnC.js';
import '../vendor/index.SMVOaj7F.js';
import '../vendor/run-once.Olz_Zkd8.js';
let globalSetup = false;
async function setupGlobalEnv(config, { environment }, executor) {
await setupCommonEnv(config);
Object.defineProperty(globalThis, "__vitest_index__", {
value: VitestIndex,
enumerable: false
});
const state = getWorkerState();
if (!state.config.snapshotOptions.snapshotEnvironment)
state.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, executor);
if (globalSetup)
return;
globalSetup = true;
setupColors(createColors(isatty(1)));
if (environment.transformMode === "web") {
const _require = createRequire(import.meta.url);
_require.extensions[".css"] = () => ({});
_require.extensions[".scss"] = () => ({});
_require.extensions[".sass"] = () => ({});
_require.extensions[".less"] = () => ({});
process.env.SSR = "";
} else {
process.env.SSR = "1";
}
globalThis.__vitest_required__ = {
util,
timers
};
installSourcemapsSupport({
getSourceMap: (source) => state.moduleCache.getSourceMap(source)
});
if (!config.disableConsoleIntercept)
await setupConsoleLogSpy();
}
async function setupConsoleLogSpy() {
const { createCustomConsole } = await import('./runtime-console.EO5ha7qv.js');
globalThis.console = createCustomConsole();
}
async function withEnv({ environment }, options, fn) {
globalThis.__vitest_environment__ = environment.name;
globalExpect.setState({
environment: environment.name
});
const env = await environment.setup(globalThis, options);
try {
await fn();
} finally {
const { setTimeout } = getSafeTimers();
await new Promise((resolve) => setTimeout(resolve));
await env.teardown(globalThis);
}
}
async function run(files, config, environment, executor) {
const workerState = getWorkerState();
await setupGlobalEnv(config, environment, executor);
await startCoverageInsideWorker(config.coverage, executor);
if (config.chaiConfig)
setupChaiConfig(config.chaiConfig);
const runner = await resolveTestRunner(config, executor);
workerState.onCancel.then((reason) => {
var _a;
closeInspector(config);
(_a = runner.onCancel) == null ? void 0 : _a.call(runner, reason);
});
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
workerState.durations.environment = performance.now();
await withEnv(environment, environment.options || config.environmentOptions || {}, async () => {
var _a, _b, _c, _d;
workerState.durations.environment = performance.now() - workerState.durations.environment;
for (const file of files) {
const isIsolatedThreads = config.pool === "threads" && (((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) ?? true);
const isIsolatedForks = config.pool === "forks" && (((_d = (_c = config.poolOptions) == null ? void 0 : _c.forks) == null ? void 0 : _d.isolate) ?? true);
if (isIsolatedThreads || isIsolatedForks) {
workerState.mockMap.clear();
resetModules(workerState.moduleCache, true);
}
workerState.filepath = file;
await startTests([file], runner);
vi.resetConfig();
vi.restoreAllMocks();
}
await stopCoverageInsideWorker(config.coverage, executor);
});
workerState.environmentTeardownRun = true;
}
export { run };

View File

@@ -0,0 +1,119 @@
import { fileURLToPath } from 'node:url';
import c from 'picocolors';
import { execa } from 'execa';
import { E as EXIT_CODE_RESTART } from './vendor/constants.5J7I254_.js';
const ENTRY = new URL("./cli.js", import.meta.url);
const NODE_ARGS = [
"--trace-deprecation",
"--experimental-wasm-threads",
"--wasm-atomics-on-non-shared-memory"
];
const SegfaultErrors = [
{
trigger: "Check failed: result.second.",
url: "https://github.com/nodejs/node/issues/43617"
},
{
trigger: "FATAL ERROR: v8::FromJust Maybe value is Nothing.",
url: "https://github.com/vitest-dev/vitest/issues/1191"
},
{
trigger: "FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.",
url: "https://github.com/nodejs/node/issues/42407"
}
];
main();
async function main() {
var _a;
let retries = 0;
const args = process.argv.slice(2);
if (process.env.VITEST_SEGFAULT_RETRY) {
retries = +process.env.VITEST_SEGFAULT_RETRY;
} else {
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith("--segfault-retry=") || args[i].startsWith("--segfaultRetry=")) {
retries = +args[i].split("=")[1];
break;
} else if ((args[i] === "--segfault-retry" || args[i] === "--segfaultRetry") && ((_a = args[i + 1]) == null ? void 0 : _a.match(/^\d+$/))) {
retries = +args[i + 1];
break;
}
}
}
if (retries <= 0) {
await import('./cli.js');
return;
}
const nodeArgs = [];
const vitestArgs = [];
for (let i = 0; i < args.length; i++) {
let matched = false;
for (const nodeArg of NODE_ARGS) {
if (args[i] === nodeArg || args[i].startsWith(`${nodeArg}=`)) {
matched = true;
nodeArgs.push(args[i]);
break;
}
}
if (!matched)
vitestArgs.push(args[i]);
}
retries = Math.max(1, retries || 1);
for (let i = 1; i <= retries; i++) {
const result = await start(nodeArgs, vitestArgs);
if (result === "restart") {
i -= 1;
continue;
}
if (i === 1 && retries === 1) {
console.log(c.yellow(`It seems to be an upstream bug of Node.js. To improve the test stability,
you could pass ${c.bold(c.green("--segfault-retry=3"))} or set env ${c.bold(c.green("VITEST_SEGFAULT_RETRY=3"))} to
have Vitest auto retries on flaky segfaults.
`));
}
if (i !== retries)
console.log(`${c.inverse(c.bold(c.magenta(" Retrying ")))} vitest ${args.join(" ")} ${c.gray(`(${i + 1} of ${retries})`)}`);
}
process.exit(1);
}
async function start(preArgs, postArgs) {
var _a;
const child = execa(
"node",
[
...preArgs,
fileURLToPath(ENTRY),
...postArgs
],
{
reject: false,
stderr: "pipe",
stdout: "inherit",
stdin: "inherit",
env: {
...process.env,
VITEST_CLI_WRAPPER: "true"
}
}
);
(_a = child.stderr) == null ? void 0 : _a.pipe(process.stderr);
const { stderr = "" } = await child;
if (child.exitCode === EXIT_CODE_RESTART)
return "restart";
for (const error of SegfaultErrors) {
if (stderr.includes(error.trigger)) {
if (process.env.GITHUB_ACTIONS)
console.log(`::warning:: Segmentfault Error Detected: ${error.trigger}
Refer to ${error.url}`);
const RED_BLOCK = c.inverse(c.red(" "));
console.log(`
${c.inverse(c.bold(c.red(" Segmentfault Error Detected ")))}
${RED_BLOCK} ${c.red(error.trigger)}
${RED_BLOCK} ${c.red(`Refer to ${error.url}`)}
`);
return "error";
}
}
process.exit(child.exitCode);
}

9
control-plane-ui/node_modules/vitest/dist/cli.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { c as createCLI } from './vendor/cac.cdAtVkJZ.js';
import 'pathe';
import 'events';
import 'picocolors';
import './vendor/base.5NT-gWu5.js';
import '@vitest/utils';
import './vendor/constants.5J7I254_.js';
createCLI().parse();

135
control-plane-ui/node_modules/vitest/dist/config.cjs generated vendored Normal file
View File

@@ -0,0 +1,135 @@
'use strict';
var os = require('node:os');
var stdEnv = require('std-env');
var vite = require('vite');
var _a$1;
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
isNode && process.platform === "win32";
var _a, _b;
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"];
const defaultCoverageExcludes = [
"coverage/**",
"dist/**",
"**/[.]**",
"packages/*/test?(s)/**",
"**/*.d.ts",
"**/virtual:*",
"**/__x00__*",
"**/\0*",
"cypress/**",
"test?(s)/**",
"test?(-*).?(c|m)[jt]s?(x)",
"**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)",
"**/__tests__/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
"**/vitest.{workspace,projects}.[jt]s?(on)",
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
];
const coverageConfigDefaults = {
provider: "v8",
enabled: false,
all: true,
clean: true,
cleanOnRerun: true,
reportsDirectory: "./coverage",
exclude: defaultCoverageExcludes,
reportOnFailure: false,
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
allowExternal: false,
ignoreEmptyLines: false,
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
};
const fakeTimersDefaults = {
loopLimit: 1e4,
shouldClearNativeTimers: true,
toFake: [
"setTimeout",
"clearTimeout",
"setInterval",
"clearInterval",
"setImmediate",
"clearImmediate",
"Date"
]
};
const config = {
allowOnly: !stdEnv.isCI,
isolate: true,
watch: !stdEnv.isCI,
globals: false,
environment: "node",
pool: "threads",
clearMocks: false,
restoreMocks: false,
mockReset: false,
include: defaultInclude,
exclude: defaultExclude,
testTimeout: 5e3,
hookTimeout: 1e4,
teardownTimeout: 1e4,
watchExclude: ["**/node_modules/**", "**/dist/**"],
forceRerunTriggers: [
"**/package.json/**",
"**/{vitest,vite}.config.*/**"
],
update: false,
reporters: [],
silent: false,
hideSkippedTests: false,
api: false,
ui: false,
uiBase: "/__vitest__/",
open: !stdEnv.isCI,
css: {
include: []
},
coverage: coverageConfigDefaults,
fakeTimers: fakeTimersDefaults,
maxConcurrency: 5,
dangerouslyIgnoreUnhandledErrors: false,
typecheck: {
checker: "tsc",
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
exclude: defaultExclude
},
slowTestThreshold: 300,
disableConsoleIntercept: false
};
const configDefaults = Object.freeze(config);
const extraInlineDeps = [
/^(?!.*(?:node_modules)).*\.mjs$/,
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
// Vite client
/vite\w*\/dist\/client\/env.mjs/,
// Nuxt
"@nuxt/test-utils"
];
function defineConfig(config) {
return config;
}
function defineProject(config) {
return config;
}
function defineWorkspace(config) {
return config;
}
Object.defineProperty(exports, "mergeConfig", {
enumerable: true,
get: function () { return vite.mergeConfig; }
});
exports.configDefaults = configDefaults;
exports.coverageConfigDefaults = coverageConfigDefaults;
exports.defaultExclude = defaultExclude;
exports.defaultInclude = defaultInclude;
exports.defineConfig = defineConfig;
exports.defineProject = defineProject;
exports.defineWorkspace = defineWorkspace;
exports.extraInlineDeps = extraInlineDeps;

16
control-plane-ui/node_modules/vitest/dist/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
export { ax as UserConfigExport, aw as UserConfigFn, au as UserConfigFnObject, av as UserConfigFnPromise, az as UserProjectConfigExport, ay as UserProjectConfigFn, a1 as UserWorkspaceConfig, aD as configDefaults, aG as coverageConfigDefaults, aF as defaultExclude, aE as defaultInclude, aA as defineConfig, aB as defineProject, aC as defineWorkspace, aH as extraInlineDeps } from './reporters-w_64AS5f.js';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';

122
control-plane-ui/node_modules/vitest/dist/config.js generated vendored Normal file
View File

@@ -0,0 +1,122 @@
import os from 'node:os';
import { isCI } from 'std-env';
export { mergeConfig } from 'vite';
var _a$1;
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
isNode && process.platform === "win32";
var _a, _b;
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"];
const defaultCoverageExcludes = [
"coverage/**",
"dist/**",
"**/[.]**",
"packages/*/test?(s)/**",
"**/*.d.ts",
"**/virtual:*",
"**/__x00__*",
"**/\0*",
"cypress/**",
"test?(s)/**",
"test?(-*).?(c|m)[jt]s?(x)",
"**/*{.,-}{test,spec}?(-d).?(c|m)[jt]s?(x)",
"**/__tests__/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
"**/vitest.{workspace,projects}.[jt]s?(on)",
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
];
const coverageConfigDefaults = {
provider: "v8",
enabled: false,
all: true,
clean: true,
cleanOnRerun: true,
reportsDirectory: "./coverage",
exclude: defaultCoverageExcludes,
reportOnFailure: false,
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
allowExternal: false,
ignoreEmptyLines: false,
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
};
const fakeTimersDefaults = {
loopLimit: 1e4,
shouldClearNativeTimers: true,
toFake: [
"setTimeout",
"clearTimeout",
"setInterval",
"clearInterval",
"setImmediate",
"clearImmediate",
"Date"
]
};
const config = {
allowOnly: !isCI,
isolate: true,
watch: !isCI,
globals: false,
environment: "node",
pool: "threads",
clearMocks: false,
restoreMocks: false,
mockReset: false,
include: defaultInclude,
exclude: defaultExclude,
testTimeout: 5e3,
hookTimeout: 1e4,
teardownTimeout: 1e4,
watchExclude: ["**/node_modules/**", "**/dist/**"],
forceRerunTriggers: [
"**/package.json/**",
"**/{vitest,vite}.config.*/**"
],
update: false,
reporters: [],
silent: false,
hideSkippedTests: false,
api: false,
ui: false,
uiBase: "/__vitest__/",
open: !isCI,
css: {
include: []
},
coverage: coverageConfigDefaults,
fakeTimers: fakeTimersDefaults,
maxConcurrency: 5,
dangerouslyIgnoreUnhandledErrors: false,
typecheck: {
checker: "tsc",
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
exclude: defaultExclude
},
slowTestThreshold: 300,
disableConsoleIntercept: false
};
const configDefaults = Object.freeze(config);
const extraInlineDeps = [
/^(?!.*(?:node_modules)).*\.mjs$/,
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
// Vite client
/vite\w*\/dist\/client\/env.mjs/,
// Nuxt
"@nuxt/test-utils"
];
function defineConfig(config) {
return config;
}
function defineProject(config) {
return config;
}
function defineWorkspace(config) {
return config;
}
export { configDefaults, coverageConfigDefaults, defaultExclude, defaultInclude, defineConfig, defineProject, defineWorkspace, extraInlineDeps };

164
control-plane-ui/node_modules/vitest/dist/coverage.d.ts generated vendored Normal file
View File

@@ -0,0 +1,164 @@
import { B as BaseCoverageOptions, a as ResolvedCoverageOptions } from './reporters-w_64AS5f.js';
import 'vite';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
interface CoverageSummaryData {
lines: Totals;
statements: Totals;
branches: Totals;
functions: Totals;
}
declare class CoverageSummary {
constructor(data: CoverageSummary | CoverageSummaryData);
merge(obj: CoverageSummary): CoverageSummary;
toJSON(): CoverageSummaryData;
isEmpty(): boolean;
data: CoverageSummaryData;
lines: Totals;
statements: Totals;
branches: Totals;
functions: Totals;
}
interface CoverageMapData {
[key: string]: FileCoverage | FileCoverageData;
}
declare class CoverageMap {
constructor(data: CoverageMapData | CoverageMap);
addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
files(): string[];
fileCoverageFor(filename: string): FileCoverage;
filter(callback: (key: string) => boolean): void;
getCoverageSummary(): CoverageSummary;
merge(data: CoverageMapData | CoverageMap): void;
toJSON(): CoverageMapData;
data: CoverageMapData;
}
interface Location {
line: number;
column: number;
}
interface Range {
start: Location;
end: Location;
}
interface BranchMapping {
loc: Range;
type: string;
locations: Range[];
line: number;
}
interface FunctionMapping {
name: string;
decl: Range;
loc: Range;
line: number;
}
interface FileCoverageData {
path: string;
statementMap: { [key: string]: Range };
fnMap: { [key: string]: FunctionMapping };
branchMap: { [key: string]: BranchMapping };
s: { [key: string]: number };
f: { [key: string]: number };
b: { [key: string]: number[] };
}
interface Totals {
total: number;
covered: number;
skipped: number;
pct: number;
}
interface Coverage {
covered: number;
total: number;
coverage: number;
}
declare class FileCoverage implements FileCoverageData {
constructor(data: string | FileCoverage | FileCoverageData);
merge(other: FileCoverageData): void;
getBranchCoverageByLine(): { [line: number]: Coverage };
getLineCoverage(): { [line: number]: number };
getUncoveredLines(): number[];
resetHits(): void;
computeBranchTotals(): Totals;
computeSimpleTotals(): Totals;
toSummary(): CoverageSummary;
toJSON(): object;
data: FileCoverageData;
path: string;
statementMap: { [key: string]: Range };
fnMap: { [key: string]: FunctionMapping };
branchMap: { [key: string]: BranchMapping };
s: { [key: string]: number };
f: { [key: string]: number };
b: { [key: string]: number[] };
}
type Threshold = 'lines' | 'functions' | 'statements' | 'branches';
interface ResolvedThreshold {
coverageMap: CoverageMap;
name: string;
thresholds: Partial<Record<Threshold, number | undefined>>;
}
declare class BaseCoverageProvider {
/**
* Check if current coverage is above configured thresholds and bump the thresholds if needed
*/
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate }: {
thresholds: ResolvedThreshold[];
perFile?: boolean;
configurationFile: unknown;
onUpdate: () => void;
}): void;
/**
* Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
*/
checkThresholds({ thresholds: allThresholds, perFile }: {
thresholds: ResolvedThreshold[];
perFile?: boolean;
}): void;
/**
* Constructs collected coverage and users' threshold options into separate sets
* where each threshold set holds their own coverage maps. Threshold set is either
* for specific files defined by glob pattern or global for all other files.
*/
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }: {
coverageMap: CoverageMap;
thresholds: NonNullable<BaseCoverageOptions['thresholds']>;
createCoverageMap: () => CoverageMap;
root: string;
}): ResolvedThreshold[];
/**
* Resolve reporters from various configuration options
*/
resolveReporters(configReporters: NonNullable<BaseCoverageOptions['reporter']>): ResolvedCoverageOptions['reporter'];
hasTerminalReporter(reporters: ResolvedCoverageOptions['reporter']): boolean;
toSlices<T>(array: T[], size: number): T[][];
}
export { BaseCoverageProvider };

186
control-plane-ui/node_modules/vitest/dist/coverage.js generated vendored Normal file
View File

@@ -0,0 +1,186 @@
import { relative } from 'pathe';
import { m as mm } from './vendor/index.xL8XjTLv.js';
import './vendor/_commonjsHelpers.jjO7Zipk.js';
import 'util';
import 'path';
const THRESHOLD_KEYS = ["lines", "functions", "statements", "branches"];
const GLOBAL_THRESHOLDS_KEY = "global";
class BaseCoverageProvider {
/**
* Check if current coverage is above configured thresholds and bump the thresholds if needed
*/
updateThresholds({ thresholds: allThresholds, perFile, configurationFile, onUpdate }) {
let updatedThresholds = false;
const config = resolveConfig(configurationFile);
assertConfigurationModule(config);
for (const { coverageMap, thresholds, name } of allThresholds) {
const summaries = perFile ? coverageMap.files().map((file) => coverageMap.fileCoverageFor(file).toSummary()) : [coverageMap.getCoverageSummary()];
const thresholdsToUpdate = [];
for (const key of THRESHOLD_KEYS) {
const threshold = thresholds[key] ?? 100;
const actual = Math.min(...summaries.map((summary) => summary[key].pct));
if (actual > threshold)
thresholdsToUpdate.push([key, actual]);
}
if (thresholdsToUpdate.length === 0)
continue;
updatedThresholds = true;
for (const [threshold, newValue] of thresholdsToUpdate) {
if (name === GLOBAL_THRESHOLDS_KEY) {
config.test.coverage.thresholds[threshold] = newValue;
} else {
const glob = config.test.coverage.thresholds[name];
glob[threshold] = newValue;
}
}
}
if (updatedThresholds) {
console.log("Updating thresholds to configuration file. You may want to push with updated coverage thresholds.");
onUpdate();
}
}
/**
* Check collected coverage against configured thresholds. Sets exit code to 1 when thresholds not reached.
*/
checkThresholds({ thresholds: allThresholds, perFile }) {
for (const { coverageMap, thresholds, name } of allThresholds) {
if (thresholds.branches === void 0 && thresholds.functions === void 0 && thresholds.lines === void 0 && thresholds.statements === void 0)
continue;
const summaries = perFile ? coverageMap.files().map((file) => ({
file,
summary: coverageMap.fileCoverageFor(file).toSummary()
})) : [{
file: null,
summary: coverageMap.getCoverageSummary()
}];
for (const { summary, file } of summaries) {
for (const thresholdKey of ["lines", "functions", "statements", "branches"]) {
const threshold = thresholds[thresholdKey];
if (threshold !== void 0) {
const coverage = summary.data[thresholdKey].pct;
if (coverage < threshold) {
process.exitCode = 1;
let errorMessage = `ERROR: Coverage for ${thresholdKey} (${coverage}%) does not meet ${name === GLOBAL_THRESHOLDS_KEY ? name : `"${name}"`} threshold (${threshold}%)`;
if (perFile && file)
errorMessage += ` for ${relative("./", file).replace(/\\/g, "/")}`;
console.error(errorMessage);
}
}
}
}
}
}
/**
* Constructs collected coverage and users' threshold options into separate sets
* where each threshold set holds their own coverage maps. Threshold set is either
* for specific files defined by glob pattern or global for all other files.
*/
resolveThresholds({ coverageMap, thresholds, createCoverageMap, root }) {
const resolvedThresholds = [];
const files = coverageMap.files();
const filesMatchedByGlobs = [];
const globalCoverageMap = createCoverageMap();
for (const key of Object.keys(thresholds)) {
if (key === "perFile" || key === "autoUpdate" || key === "100" || THRESHOLD_KEYS.includes(key))
continue;
const glob = key;
const globThresholds = resolveGlobThresholds(thresholds[glob]);
const globCoverageMap = createCoverageMap();
const matchingFiles = files.filter((file) => mm.isMatch(relative(root, file), glob));
filesMatchedByGlobs.push(...matchingFiles);
for (const file of matchingFiles) {
const fileCoverage = coverageMap.fileCoverageFor(file);
globCoverageMap.addFileCoverage(fileCoverage);
}
resolvedThresholds.push({
name: glob,
coverageMap: globCoverageMap,
thresholds: globThresholds
});
}
for (const file of files.filter((file2) => !filesMatchedByGlobs.includes(file2))) {
const fileCoverage = coverageMap.fileCoverageFor(file);
globalCoverageMap.addFileCoverage(fileCoverage);
}
resolvedThresholds.unshift({
name: GLOBAL_THRESHOLDS_KEY,
coverageMap: globalCoverageMap,
thresholds: {
branches: thresholds.branches,
functions: thresholds.functions,
lines: thresholds.lines,
statements: thresholds.statements
}
});
return resolvedThresholds;
}
/**
* Resolve reporters from various configuration options
*/
resolveReporters(configReporters) {
if (!Array.isArray(configReporters))
return [[configReporters, {}]];
const resolvedReporters = [];
for (const reporter of configReporters) {
if (Array.isArray(reporter)) {
resolvedReporters.push([reporter[0], reporter[1] || {}]);
} else {
resolvedReporters.push([reporter, {}]);
}
}
return resolvedReporters;
}
hasTerminalReporter(reporters) {
return reporters.some(([reporter]) => reporter === "text" || reporter === "text-summary" || reporter === "text-lcov" || reporter === "teamcity");
}
toSlices(array, size) {
return array.reduce((chunks, item) => {
const index = Math.max(0, chunks.length - 1);
const lastChunk = chunks[index] || [];
chunks[index] = lastChunk;
if (lastChunk.length >= size)
chunks.push([item]);
else
lastChunk.push(item);
return chunks;
}, []);
}
}
function resolveGlobThresholds(thresholds) {
if (!thresholds || typeof thresholds !== "object")
return {};
return {
lines: "lines" in thresholds && typeof thresholds.lines === "number" ? thresholds.lines : void 0,
branches: "branches" in thresholds && typeof thresholds.branches === "number" ? thresholds.branches : void 0,
functions: "functions" in thresholds && typeof thresholds.functions === "number" ? thresholds.functions : void 0,
statements: "statements" in thresholds && typeof thresholds.statements === "number" ? thresholds.statements : void 0
};
}
function assertConfigurationModule(config) {
try {
if (typeof config.test.coverage.thresholds !== "object")
throw new Error("Expected config.test.coverage.thresholds to be an object");
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
throw new Error(`Unable to parse thresholds from configuration file: ${message}`);
}
}
function resolveConfig(configModule) {
const mod = configModule.exports.default;
try {
if (mod.$type === "object")
return mod;
if (mod.$type === "function-call") {
if (mod.$args[0].$type === "object")
return mod.$args[0];
if (mod.$args[0].$type === "arrow-function-expression" && mod.$args[0].$body.$type === "object")
return mod.$args[0].$body;
}
} catch (error) {
throw new Error(error instanceof Error ? error.message : String(error));
}
throw new Error("Failed to update coverage thresholds. Configuration file is too complex.");
}
export { BaseCoverageProvider };

View File

@@ -0,0 +1,35 @@
import { E as Environment } from './reporters-w_64AS5f.js';
import 'vite';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
declare const environments: {
node: Environment;
jsdom: Environment;
'happy-dom': Environment;
'edge-runtime': Environment;
};
interface PopulateOptions {
bindFunctions?: boolean;
additionalKeys?: string[];
}
declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
keys: Set<string>;
skipKeys: string[];
originals: Map<string | symbol, any>;
};
export { environments as builtinEnvironments, populateGlobal };

View File

@@ -0,0 +1,2 @@
export { e as builtinEnvironments, p as populateGlobal } from './vendor/index.GVFv9dZ0.js';
import 'node:console';

151
control-plane-ui/node_modules/vitest/dist/execute.d.ts generated vendored Normal file
View File

@@ -0,0 +1,151 @@
import vm from 'node:vm';
import { ViteNodeRunner } from 'vite-node/client';
import { ViteNodeRunnerOptions } from 'vite-node';
import { ar as PendingSuiteMock, as as MockFactory, e as RuntimeRPC, W as WorkerGlobalState, at as MockMap } from './reporters-w_64AS5f.js';
import 'vite';
import '@vitest/runner';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
type Key = string | symbol;
interface MockContext {
/**
* When mocking with a factory, this refers to the module that imported the mock.
*/
callstack: null | string[];
}
declare class VitestMocker {
executor: VitestExecutor;
static pendingIds: PendingSuiteMock[];
private spyModule?;
private resolveCache;
private primitives;
private filterPublicKeys;
private mockContext;
constructor(executor: VitestExecutor);
private get root();
private get mockMap();
private get moduleCache();
private get moduleDirectories();
initializeSpyModule(): Promise<void>;
private deleteCachedItem;
private isAModuleDirectory;
getSuiteFilepath(): string;
private createError;
getMocks(): {
[x: string]: string | MockFactory | null;
};
private resolvePath;
resolveMocks(): Promise<void>;
private callFunctionMock;
getMockContext(): MockContext;
getMockPath(dep: string): string;
getDependencyMock(id: string): string | MockFactory | null;
normalizePath(path: string): string;
resolveMockPath(mockPath: string, external: string | null): string | null;
mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
unmockPath(path: string): void;
mockPath(originalId: string, path: string, external: string | null, factory: MockFactory | undefined): void;
importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
importMock(rawId: string, importee: string): Promise<any>;
requestWithMock(url: string, callstack: string[]): Promise<any>;
queueMock(id: string, importer: string, factory?: MockFactory, throwIfCached?: boolean): void;
queueUnmock(id: string, importer: string, throwIfCached?: boolean): void;
}
interface ModuleEvaluateOptions {
timeout?: vm.RunningScriptOptions['timeout'] | undefined;
breakOnSigint?: vm.RunningScriptOptions['breakOnSigint'] | undefined;
}
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
assert: Object;
}) => VMModule | Promise<VMModule>;
type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
declare class VMModule {
dependencySpecifiers: readonly string[];
error: any;
identifier: string;
context: vm.Context;
namespace: Object;
status: ModuleStatus;
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
link(linker: ModuleLinker): Promise<void>;
}
declare class FileMap {
private fsCache;
private fsBufferCache;
readFile(path: string): string;
readBuffer(path: string): Buffer;
}
interface ExternalModulesExecutorOptions {
context: vm.Context;
fileMap: FileMap;
packageCache: Map<string, any>;
transform: RuntimeRPC['transform'];
interopDefault?: boolean;
viteClientModule: Record<string, unknown>;
}
declare class ExternalModulesExecutor {
#private;
private options;
private cjs;
private esm;
private vite;
private context;
private fs;
private resolvers;
constructor(options: ExternalModulesExecutorOptions);
import(identifier: string): Promise<Object>;
require(identifier: string): any;
createRequire(identifier: string): NodeRequire;
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
resolve(specifier: string, parent: string): string;
private findNearestPackageData;
private wrapCoreSynteticModule;
private wrapCommonJsSynteticModule;
private getModuleInformation;
private createModule;
private get isNetworkSupported();
}
interface ExecuteOptions extends ViteNodeRunnerOptions {
mockMap: MockMap;
moduleDirectories?: string[];
state: WorkerGlobalState;
context?: vm.Context;
externalModulesExecutor?: ExternalModulesExecutor;
}
declare class VitestExecutor extends ViteNodeRunner {
options: ExecuteOptions;
mocker: VitestMocker;
externalModules?: ExternalModulesExecutor;
private primitives;
constructor(options: ExecuteOptions);
protected getContextPrimitives(): {
Object: ObjectConstructor;
Reflect: typeof Reflect;
Symbol: SymbolConstructor;
};
get state(): WorkerGlobalState;
shouldResolveId(id: string, _importee?: string | undefined): boolean;
originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
resolveUrl(id: string, importer?: string): Promise<[string, string]>;
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
importExternalModule(path: string): Promise<any>;
dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
prepareContext(context: Record<string, any>): Record<string, any>;
}
export { VitestExecutor };

11
control-plane-ui/node_modules/vitest/dist/execute.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
export { V as VitestExecutor } from './vendor/execute.fL3szUAI.js';
import 'node:vm';
import 'node:url';
import 'node:fs';
import 'vite-node/client';
import 'vite-node/utils';
import 'pathe';
import '@vitest/utils/error';
import './path.js';
import '@vitest/utils';
import './vendor/base.5NT-gWu5.js';

713
control-plane-ui/node_modules/vitest/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
import { TaskPopulated, File, TaskResultPack, CancelReason } from '@vitest/runner';
export { Custom, DoneCallback, ExtendedContext, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskContext, TaskCustomOptions, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
export { b as bench } from './suite-dWqIFb_-.js';
import { ExpectStatic } from '@vitest/expect';
export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
import { F as FakeTimerInstallOpts, M as MockFactoryWithHelper, s as RuntimeConfig, P as ProvidedContext, A as AfterSuiteRunMeta, t as UserConsoleLog, R as ResolvedConfig, u as ModuleGraphData, v as Reporter } from './reporters-w_64AS5f.js';
export { Q as ApiConfig, aa as ArgumentsType, a9 as Arrayable, a7 as Awaitable, B as BaseCoverageOptions, ap as BenchFunction, an as Benchmark, aq as BenchmarkAPI, ao as BenchmarkResult, am as BenchmarkUserOptions, a0 as BrowserConfigOptions, r as BrowserScript, L as BuiltinEnvironment, O as CSSModuleScopeStrategy, y as CollectLineNumbers, z as CollectLines, ac as Constructable, G as Context, f as ContextRPC, a3 as ContextTestEnvironment, aj as CoverageIstanbulOptions, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule, ai as CoverageReporter, ak as CoverageV8Options, al as CustomProviderOptions, X as DepsOptimizationOptions, E as Environment, S as EnvironmentOptions, ae as EnvironmentReturn, K as HappyDOMOptions, Z as InlineConfig, J as JSDOMOptions, ad as ModuleCache, ab as MutableArray, a8 as Nullable, ag as OnServerRestartHandler, H as Pool, I as PoolOptions, $ as ProjectConfig, w as RawErrsMap, ah as ReportContext, a5 as ResolveIdFunction, a as ResolvedCoverageOptions, a4 as ResolvedTestEnvironment, D as RootAndTarget, a2 as RunnerRPC, e as RuntimeRPC, Y as TransformModePatterns, x as TscErrorInfo, _ as TypecheckConfig, U as UserConfig, a1 as UserWorkspaceConfig, i as Vitest, N as VitestEnvironment, V as VitestRunMode, af as VmEnvironmentReturn, g as WorkerContext, W as WorkerGlobalState, a6 as WorkerRPC } from './reporters-w_64AS5f.js';
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, MockInstance } from '@vitest/spy';
export { Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
import { SnapshotResult } from '@vitest/snapshot';
export { SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotSerializer, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, UncheckedSnapshot } from '@vitest/snapshot';
export { DiffOptions } from '@vitest/utils/diff';
import { TransformResult } from 'vite';
import * as chai from 'chai';
export { chai };
export { assert, should } from 'chai';
export { ErrorWithDiff, ParsedStack } from '@vitest/utils';
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
import '@vitest/runner/utils';
import 'vite-node';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
declare type Not<T extends boolean> = T extends true ? false : true;
declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
declare type Eq<Left extends boolean, Right extends boolean> = Left extends true ? Right : Not<Right>;
declare const secret: unique symbol;
declare type Secret = typeof secret;
declare type IsNever<T> = [T] extends [never] ? true : false;
declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;
declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
declare type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...';
/** Subjective "useful" keys from a type. For objects it's just `keyof` but for tuples/arrays it's the number keys
* @example
* UsefulKeys<{a: 1; b: 2}> // 'a' | 'b'
* UsefulKeys<['a', 'b']> // '0' | '1'
* UsefulKeys<string[]> // number
*/
declare type UsefulKeys<T> = T extends any[] ? {
[K in keyof T]: K;
}[number] : keyof T;
declare type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : {
[K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
} : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
/**
* Recursively walk a type and replace it with a branded type related to the original. This is useful for
* equality-checking stricter than `A extends B ? B extends A ? true : false : false`, because it detects
* the difference between a few edge-case types that vanilla typescript doesn't by default:
* - `any` vs `unknown`
* - `{ readonly a: string }` vs `{ a: string }`
* - `{ a?: string }` vs `{ a: string | undefined }`
*
* Note: not very performant for complex types - this should only be used when you know you need it. If doing
* an equality check, it's almost always better to use `StrictEqualUsingTSInternalIdenticalToOperator`.
*/
declare type DeepBrand<T> = IsNever<T> extends true ? {
type: 'never';
} : IsAny<T> extends true ? {
type: 'any';
} : IsUnknown<T> extends true ? {
type: 'unknown';
} : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
type: 'primitive';
value: T;
} : T extends new (...args: any[]) => any ? {
type: 'constructor';
params: ConstructorParams<T>;
instance: DeepBrand<InstanceType<Extract<T, new (...args: any) => any>>>;
} : T extends (...args: infer P) => infer R ? {
type: 'function';
params: DeepBrand<P>;
return: DeepBrand<R>;
this: DeepBrand<ThisParameterType<T>>;
props: DeepBrand<Omit<T, keyof Function>>;
} : T extends any[] ? {
type: 'array';
items: {
[K in keyof T]: T[K];
};
} : {
type: 'object';
properties: {
[K in keyof T]: DeepBrand<T[K]>;
};
readonly: ReadonlyKeys<T>;
required: RequiredKeys<T>;
optional: OptionalKeys<T>;
constructorParams: DeepBrand<ConstructorParams<T>>;
};
declare type RequiredKeys<T> = Extract<{
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
}[keyof T], keyof T>;
declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
declare type ReadonlyKeys<T> = Extract<{
[K in keyof T]-?: ReadonlyEquivalent<{
[_K in K]: T[K];
}, {
-readonly [_K in K]: T[K];
}> extends true ? never : K;
}[keyof T], keyof T>;
declare type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>;
/** Returns true if `L extends R`. Explicitly checks for `never` since that can give unexpected results. */
declare type Extends<L, R> = IsNever<L> extends true ? IsNever<R> : [L] extends [R] ? true : false;
declare type ExtendsUsingBranding<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
declare type ExtendsExcludingAnyOrNever<L, R> = IsAny<L> extends true ? IsAny<R> : Extends<L, R>;
declare type StrictEqualUsingTSInternalIdenticalToOperator<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends <T>() => T extends (R & T) | T ? true : false ? IsNever<L> extends IsNever<R> ? true : false : false;
declare type StrictEqualUsingBranding<Left, Right> = And<[
ExtendsUsingBranding<Left, Right>,
ExtendsUsingBranding<Right, Left>
]>;
declare type Params<Actual> = Actual extends (...args: infer P) => any ? P : never;
declare type ConstructorParams<Actual> = Actual extends new (...args: infer P) => any ? Actual extends new () => any ? P | [] : P : never;
declare const mismatch: unique symbol;
declare type Mismatch = {
[mismatch]: 'mismatch';
};
/** A type which should match anything passed as a value but *doesn't* match `Mismatch` - helps TypeScript select the right overload for `toEqualTypeOf` and `toMatchTypeOf`. */
declare const avalue: unique symbol;
declare type AValue = {
[avalue]?: undefined;
} | string | number | boolean | symbol | bigint | null | undefined | void;
declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch];
declare const inverted: unique symbol;
declare type Inverted<T> = {
[inverted]: T;
};
declare const expectNull: unique symbol;
declare type ExpectNull<T> = {
[expectNull]: T;
result: ExtendsExcludingAnyOrNever<T, null>;
};
declare const expectUndefined: unique symbol;
declare type ExpectUndefined<T> = {
[expectUndefined]: T;
result: ExtendsExcludingAnyOrNever<T, undefined>;
};
declare const expectNumber: unique symbol;
declare type ExpectNumber<T> = {
[expectNumber]: T;
result: ExtendsExcludingAnyOrNever<T, number>;
};
declare const expectString: unique symbol;
declare type ExpectString<T> = {
[expectString]: T;
result: ExtendsExcludingAnyOrNever<T, string>;
};
declare const expectBoolean: unique symbol;
declare type ExpectBoolean<T> = {
[expectBoolean]: T;
result: ExtendsExcludingAnyOrNever<T, boolean>;
};
declare const expectVoid: unique symbol;
declare type ExpectVoid<T> = {
[expectVoid]: T;
result: ExtendsExcludingAnyOrNever<T, void>;
};
declare const expectFunction: unique symbol;
declare type ExpectFunction<T> = {
[expectFunction]: T;
result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
};
declare const expectObject: unique symbol;
declare type ExpectObject<T> = {
[expectObject]: T;
result: ExtendsExcludingAnyOrNever<T, object>;
};
declare const expectArray: unique symbol;
declare type ExpectArray<T> = {
[expectArray]: T;
result: ExtendsExcludingAnyOrNever<T, any[]>;
};
declare const expectSymbol: unique symbol;
declare type ExpectSymbol<T> = {
[expectSymbol]: T;
result: ExtendsExcludingAnyOrNever<T, symbol>;
};
declare const expectAny: unique symbol;
declare type ExpectAny<T> = {
[expectAny]: T;
result: IsAny<T>;
};
declare const expectUnknown: unique symbol;
declare type ExpectUnknown<T> = {
[expectUnknown]: T;
result: IsUnknown<T>;
};
declare const expectNever: unique symbol;
declare type ExpectNever<T> = {
[expectNever]: T;
result: IsNever<T>;
};
declare const expectNullable: unique symbol;
declare type ExpectNullable<T> = {
[expectNullable]: T;
result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
};
declare type Scolder<Expecter extends {
result: boolean;
}, Options extends {
positive: boolean;
}> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;
interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
positive: true;
branded: false;
}> {
toEqualTypeOf: {
<Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
<Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
};
toMatchTypeOf: {
<Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
<Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
};
toHaveProperty: <K extends keyof Actual>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, true>) => K extends keyof Actual ? PositiveExpectTypeOf<Actual[K]> : true;
not: NegativeExpectTypeOf<Actual>;
branded: {
toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
};
}
interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
positive: false;
}> {
toEqualTypeOf: {
<Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
<Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
};
toMatchTypeOf: {
<Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
};
toHaveProperty: <K extends string | number | symbol>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, false>) => true;
}
declare type ExpectTypeOf<Actual, Options extends {
positive: boolean;
}> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;
interface BaseExpectTypeOf<Actual, Options extends {
positive: boolean;
}> {
toBeAny: Scolder<ExpectAny<Actual>, Options>;
toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
toBeNever: Scolder<ExpectNever<Actual>, Options>;
toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
toBeObject: Scolder<ExpectObject<Actual>, Options>;
toBeArray: Scolder<ExpectArray<Actual>, Options>;
toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
toBeString: Scolder<ExpectString<Actual>, Options>;
toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
toBeNull: Scolder<ExpectNull<Actual>, Options>;
toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
toBeCallableWith: Options['positive'] extends true ? (...args: Params<Actual>) => true : never;
toBeConstructibleWith: Options['positive'] extends true ? (...args: ConstructorParams<Actual>) => true : never;
extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
parameter: <K extends keyof Params<Actual>>(number: K) => ExpectTypeOf<Params<Actual>[K], Options>;
parameters: ExpectTypeOf<Params<Actual>, Options>;
constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, Options>;
thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never;
returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, Options> : never;
resolves: Actual extends PromiseLike<infer R> ? ExpectTypeOf<R, Options> : never;
items: Actual extends ArrayLike<infer R> ? ExpectTypeOf<R, Options> : never;
guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
}
declare type _ExpectTypeOf = {
<Actual>(actual: Actual): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
<Actual>(): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
};
/**
* Similar to Jest's `expect`, but with type-awareness.
* Gives you access to a number of type-matchers that let you make assertions about the
* form of a reference or generic type parameter.
*
* @example
* import {foo, bar} from '../foo'
* import {expectTypeOf} from 'expect-type'
*
* test('foo types', () => {
* // make sure `foo` has type {a: number}
* expectTypeOf(foo).toMatchTypeOf({a: 1})
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
*
* // make sure `bar` is a function taking a string:
* expectTypeOf(bar).parameter(0).toBeString()
* expectTypeOf(bar).returns.not.toBeAny()
* })
*
* @description
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
*/
declare const expectTypeOf: _ExpectTypeOf;
interface AssertType {
<T>(value: T): void;
}
declare const assertType: AssertType;
/**
* This utils allows computational intensive tasks to only be ran once
* across test reruns to improve the watch mode performance.
*
* Currently only works with `poolOptions.<pool>.isolate: false`
*
* @experimental
*/
declare function runOnce<T>(fn: (() => T), key?: string): T;
/**
* Get a boolean indicates whether the task is running in the first time.
* Could only be `false` in watch mode.
*
* Currently only works with `isolate: false`
*
* @experimental
*/
declare function isFirstRun(): boolean;
declare function createExpect(test?: TaskPopulated): ExpectStatic;
declare const globalExpect: ExpectStatic;
type WaitForCallback<T> = () => T | Promise<T>;
interface WaitForOptions {
/**
* @description Time in ms between each check callback
* @default 50ms
*/
interval?: number;
/**
* @description Time in ms after which the throw a timeout error
* @default 1000ms
*/
timeout?: number;
}
declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>;
type WaitUntilCallback<T> = () => T | Promise<T>;
interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'> {
}
type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;
type ESModuleExports = Record<string, unknown>;
interface VitestUtils {
/**
* Checks if fake timers are enabled.
*/
isFakeTimers: () => boolean;
/**
* This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called.
*/
useFakeTimers: (config?: FakeTimerInstallOpts) => VitestUtils;
/**
* Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded.
*/
useRealTimers: () => VitestUtils;
/**
* This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call.
* It will not fire any timer that was initiated during its call.
*/
runOnlyPendingTimers: () => VitestUtils;
/**
* This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones.
* It will not fire any timer that was initiated during its call.
*/
runOnlyPendingTimersAsync: () => Promise<VitestUtils>;
/**
* This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
* If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
*/
runAllTimers: () => VitestUtils;
/**
* This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers.
* If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
*/
runAllTimersAsync: () => Promise<VitestUtils>;
/**
* Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.
*/
runAllTicks: () => VitestUtils;
/**
* This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first.
*/
advanceTimersByTime: (ms: number) => VitestUtils;
/**
* This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include and await asynchronously set timers.
*/
advanceTimersByTimeAsync: (ms: number) => Promise<VitestUtils>;
/**
* Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself.
*/
advanceTimersToNextTimer: () => VitestUtils;
/**
* Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call.
*/
advanceTimersToNextTimerAsync: () => Promise<VitestUtils>;
/**
* Get the number of waiting timers.
*/
getTimerCount: () => number;
/**
* If fake timers are enabled, this method simulates a user changing the system clock (will affect date related API like `hrtime`, `performance.now` or `new Date()`) - however, it will not fire any timers.
* If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls.
*/
setSystemTime: (time: number | string | Date) => VitestUtils;
/**
* Returns mocked current date that was set using `setSystemTime`. If date is not mocked the method will return `null`.
*/
getMockedSystemTime: () => Date | null;
/**
* When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function.
*/
getRealSystemTime: () => number;
/**
* Removes all timers that are scheduled to run. These timers will never run in the future.
*/
clearAllTimers: () => VitestUtils;
/**
* Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock).
*
* @example
* const cart = {
* getApples: () => 42
* }
*
* const spy = vi.spyOn(cart, 'getApples').mockReturnValue(10)
*
* expect(cart.getApples()).toBe(10)
* expect(spy).toHaveBeenCalled()
* expect(spy).toHaveReturnedWith(10)
*/
spyOn: typeof spyOn;
/**
* Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](https://vitest.dev/api/mock).
*
* If no function is given, mock will return `undefined`, when invoked.
*
* @example
* const getApples = vi.fn(() => 0)
*
* getApples()
*
* expect(getApples).toHaveBeenCalled()
* expect(getApples).toHaveReturnedWith(0)
*
* getApples.mockReturnValueOnce(5)
*
* expect(getApples()).toBe(5)
* expect(getApples).toHaveNthReturnedWith(2, 5)
*/
fn: typeof fn;
/**
* Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out.
*
* This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start.
*
* @example
* const server = createServer()
*
* await vi.waitFor(
* () => {
* if (!server.isReady)
* throw new Error('Server not started')
*
* console.log('Server started')
* }, {
* timeout: 500, // default is 1000
* interval: 20, // default is 50
* }
* )
*/
waitFor: typeof waitFor;
/**
* This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received.
*
* If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.
*
* @example
* const element = await vi.waitUntil(
* () => document.querySelector('.element'),
* {
* timeout: 500, // default is 1000
* interval: 20, // default is 50
* }
* )
*
* // do something with the element
* expect(element.querySelector('.element-child')).toBeTruthy()
*/
waitUntil: typeof waitUntil;
/**
* Run the factory before imports are evaluated. You can return a value from the factory
* to reuse it inside your [`vi.mock`](https://vitest.dev/api/vi#vi-mock) factory and tests.
*
* If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in.
*/
hoisted: <T>(factory: () => T) => T;
/**
* Mocks every import call to the module even if it was already statically imported.
*
* The call to `vi.mock` is hoisted to the top of the file, so you don't have access to variables declared in the global file scope
* unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
* @param path Path to the module. Can be aliased, if your Vitest config supports it
* @param factory Mocked module factory. The result of this function will be an exports object
*/
mock: (path: string, factory?: MockFactoryWithHelper) => void;
/**
* Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
*
* This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
* @param path Path to the module. Can be aliased, if your Vitest config supports it
*/
unmock: (path: string) => void;
/**
* Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
*
* Unlike [`vi.mock`](https://vitest.dev/api/vi#vi-mock), this method will not mock statically imported modules because it is not hoisted to the top of the file.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
* @param path Path to the module. Can be aliased, if your Vitest config supports it
* @param factory Mocked module factory. The result of this function will be an exports object
*/
doMock: (path: string, factory?: MockFactoryWithHelper) => void;
/**
* Removes module from mocked registry. All subsequent calls to import will return original module.
*
* Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
* @param path Path to the module. Can be aliased, if your Vitest config supports it
*/
doUnmock: (path: string) => void;
/**
* Imports module, bypassing all checks if it should be mocked.
* Can be useful if you want to mock module partially.
* @example
* vi.mock('./example.js', async () => {
* const axios = await vi.importActual<typeof import('./example.js')>('./example.js')
*
* return { ...axios, get: vi.fn() }
* })
* @param path Path to the module. Can be aliased, if your config supports it
*/
importActual: <T = ESModuleExports>(path: string) => Promise<T>;
/**
* Imports a module with all of its properties and nested properties mocked.
*
* Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
* @example
* const example = await vi.importMock<typeof import('./example.js')>('./example.js')
* example.calc.mockReturnValue(10)
* expect(example.calc()).toBe(10)
* @param path Path to the module. Can be aliased, if your config supports it
* @returns Fully mocked module
*/
importMock: <T = ESModuleExports>(path: string) => Promise<MaybeMockedDeep<T>>;
/**
* Type helper for TypeScript. Just returns the object that was passed.
*
* When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will only make TypeScript believe that
* the first level values are mocked. You can pass down `{ deep: true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually is.
* @example
* import example from './example.js'
* vi.mock('./example.js')
*
* test('1 + 1 equals 10' async () => {
* vi.mocked(example.calc).mockReturnValue(10)
* expect(example.calc(1, '+', 1)).toBe(10)
* })
* @param item Anything that can be mocked
* @param deep If the object is deeply mocked
* @param options If the object is partially or deeply mocked
*/
mocked: (<T>(item: T, deep?: false) => MaybeMocked<T>) & (<T>(item: T, deep: true) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
partial?: false;
deep?: false;
}) => MaybeMocked<T>) & (<T>(item: T, options: {
partial?: false;
deep: true;
}) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
partial: true;
deep?: false;
}) => MaybePartiallyMocked<T>) & (<T>(item: T, options: {
partial: true;
deep: true;
}) => MaybePartiallyMockedDeep<T>) & (<T>(item: T) => MaybeMocked<T>);
/**
* Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type.
*/
isMockFunction: (fn: any) => fn is MockInstance;
/**
* Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
*
* It is useful if you need to clean up mock between different assertions.
*/
clearAllMocks: () => VitestUtils;
/**
* Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will empty `.mock` state, reset "once" implementations and force the base implementation to return `undefined` when invoked.
*
* This is useful when you want to completely reset a mock to the default state.
*/
resetAllMocks: () => VitestUtils;
/**
* Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations.
*/
restoreAllMocks: () => VitestUtils;
/**
* Makes value available on global namespace.
* Useful, if you want to have global variables available, like `IntersectionObserver`.
* You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
*/
stubGlobal: (name: string | symbol | number, value: unknown) => VitestUtils;
/**
* Changes the value of `import.meta.env` and `process.env`.
* You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
*/
stubEnv: <T extends string>(name: T, value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string) => VitestUtils;
/**
* Reset the value to original value that was available before first `vi.stubGlobal` was called.
*/
unstubAllGlobals: () => VitestUtils;
/**
* Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
*/
unstubAllEnvs: () => VitestUtils;
/**
* Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported.
* Top-level imports cannot be re-evaluated. Might be useful to isolate modules where local state conflicts between tests.
*
* This method does not reset mocks registry. To clear mocks registry, use [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock) or [`vi.doUnmock`](https://vitest.dev/api/vi#vi-dounmock).
*/
resetModules: () => VitestUtils;
/**
* Wait for all imports to load. Useful, if you have a synchronous call that starts
* importing a module that you cannot await otherwise.
* Will also wait for new imports, started during the wait.
*/
dynamicImportSettled: () => Promise<void>;
/**
* Updates runtime config. You can only change values that are used when executing tests.
*/
setConfig: (config: RuntimeConfig) => void;
/**
* If config was changed with `vi.setConfig`, this will reset it to the original state.
*/
resetConfig: () => void;
}
declare const vitest: VitestUtils;
declare const vi: VitestUtils;
declare function getRunningMode(): "run" | "watch";
declare function isWatchMode(): boolean;
/**
* Gives access to injected context provided from the main thread.
* This usually returns a value provided by `globalSetup` or an external library.
*/
declare function inject<T extends keyof ProvidedContext>(key: T): ProvidedContext[T];
interface TransformResultWithSource extends TransformResult {
source?: string;
}
interface WebSocketHandlers {
onUnhandledError: (error: unknown, type: string) => Promise<void>;
onCollected: (files?: File[]) => Promise<void>;
onTaskUpdate: (packs: TaskResultPack[]) => void;
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
onCancel: (reason: CancelReason) => void;
getCountOfFailedTests: () => number;
sendLog: (log: UserConsoleLog) => void;
getFiles: () => File[];
getTestFiles: () => Promise<[name: string, file: string][]>;
getPaths: () => string[];
getConfig: () => ResolvedConfig;
resolveSnapshotPath: (testPath: string) => string;
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
getModuleGraph: (id: string) => Promise<ModuleGraphData>;
getBrowserFileSourceMap: (id: string) => Promise<TransformResult['map'] | undefined>;
getTransformResult: (id: string) => Promise<TransformResultWithSource | undefined>;
readSnapshotFile: (id: string) => Promise<string | null>;
readTestFile: (id: string) => Promise<string | null>;
saveTestFile: (id: string, content: string) => Promise<void>;
saveSnapshotFile: (id: string, content: string) => Promise<void>;
removeSnapshotFile: (id: string) => Promise<void>;
snapshotSaved: (snapshot: SnapshotResult) => void;
rerun: (files: string[]) => Promise<void>;
updateSnapshot: (file?: File) => Promise<void>;
getProvidedContext: () => ProvidedContext;
getUnhandledErrors: () => unknown[];
finishBrowserTests: () => void;
getBrowserFiles: () => string[];
debug: (...args: string[]) => void;
}
interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog' | 'onPathsCollected'> {
onCancel: (reason: CancelReason) => void;
onFinishedReportCoverage: () => void;
}
export { AfterSuiteRunMeta, type AssertType, type ExpectTypeOf, ModuleGraphData, ProvidedContext, Reporter, ResolvedConfig, RuntimeConfig, type TransformResultWithSource, UserConsoleLog, type VitestUtils, type WebSocketEvents, type WebSocketHandlers, assertType, createExpect, globalExpect as expect, expectTypeOf, getRunningMode, inject, isFirstRun, isWatchMode, runOnce, vi, vitest };

30
control-plane-ui/node_modules/vitest/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
export { b as bench } from './vendor/benchmark.yGkUTKnC.js';
export { i as isFirstRun, a as runOnce } from './vendor/run-once.Olz_Zkd8.js';
export { c as createExpect, a as expect, v as vi, b as vitest } from './vendor/vi.YFlodzP_.js';
import { d as dist } from './vendor/index.dI9lHwVn.js';
export { b as assertType, g as getRunningMode, i as inject, a as isWatchMode } from './vendor/index.dI9lHwVn.js';
import * as chai from 'chai';
export { chai };
export { assert, should } from 'chai';
import '@vitest/runner/utils';
import '@vitest/utils';
import './vendor/index.SMVOaj7F.js';
import 'pathe';
import './vendor/global.CkGT_TMy.js';
import './vendor/env.AtSIuHFg.js';
import 'std-env';
import './vendor/_commonjsHelpers.jjO7Zipk.js';
import '@vitest/expect';
import '@vitest/snapshot';
import '@vitest/utils/error';
import './vendor/tasks.IknbGB2n.js';
import '@vitest/utils/source-map';
import './vendor/base.5NT-gWu5.js';
import './vendor/date.Ns1pGd_X.js';
import '@vitest/spy';
var expectTypeOf = dist.expectTypeOf;
export { expectTypeOf };

68
control-plane-ui/node_modules/vitest/dist/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import { V as VitestRunMode, U as UserConfig, h as VitestOptions, i as Vitest, R as ResolvedConfig, P as ProvidedContext, j as WorkspaceProject, e as RuntimeRPC, T as TestSequencer, k as WorkspaceSpec } from './reporters-w_64AS5f.js';
export { p as BrowserProvider, o as BrowserProviderInitializationOptions, q as BrowserProviderOptions, r as BrowserScript, l as ProcessPool, n as TestSequencerConstructor, m as VitestPackageInstaller } from './reporters-w_64AS5f.js';
import { UserConfig as UserConfig$1, Plugin } from 'vite';
import { Writable } from 'node:stream';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest>;
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
interface CliOptions extends UserConfig {
/**
* Override the watch mode
*/
run?: boolean;
/**
* Retry the test suite if it crashes due to a segfault (default: true)
*/
segfaultRetry?: number;
/**
* Removes colors from the console output
*/
color?: boolean;
}
/**
* Start Vitest programmatically
*
* Returns a Vitest instance if initialized successfully.
*/
declare function startVitest(mode: VitestRunMode, cliFilters?: string[], options?: CliOptions, viteOverrides?: UserConfig$1, vitestOptions?: VitestOptions): Promise<Vitest | undefined>;
interface CLIOptions {
allowUnknownOptions?: boolean;
}
declare function parseCLI(argv: string | string[], config?: CLIOptions): {
filter: string[];
options: CliOptions;
};
declare function registerConsoleShortcuts(ctx: Vitest, stdin: NodeJS.ReadStream | undefined, stdout: NodeJS.WriteStream | Writable): () => void;
interface GlobalSetupContext {
config: ResolvedConfig;
provide: <T extends keyof ProvidedContext>(key: T, value: ProvidedContext[T]) => void;
}
declare function createMethodsRPC(project: WorkspaceProject): RuntimeRPC;
declare class BaseSequencer implements TestSequencer {
protected ctx: Vitest;
constructor(ctx: Vitest);
shard(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
sort(files: WorkspaceSpec[]): Promise<WorkspaceSpec[]>;
}
export { BaseSequencer, type GlobalSetupContext, TestSequencer, Vitest, VitestPlugin, WorkspaceProject, WorkspaceSpec, createMethodsRPC, createVitest, parseCLI, registerConsoleShortcuts, startVitest };

68
control-plane-ui/node_modules/vitest/dist/node.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
export { b as VitestPackageInstaller, V as VitestPlugin, a as createMethodsRPC, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor/cli-api.OdDWuB7Y.js';
export { p as parseCLI } from './vendor/cac.cdAtVkJZ.js';
export { B as BaseSequencer } from './vendor/index.-xs08BYx.js';
import 'pathe';
import './vendor/constants.5J7I254_.js';
import './vendor/coverage.E7sG1b3r.js';
import './vendor/index.GVFv9dZ0.js';
import 'node:console';
import 'vite';
import 'node:path';
import 'node:url';
import 'node:process';
import 'node:fs';
import 'node:worker_threads';
import './vendor/_commonjsHelpers.jjO7Zipk.js';
import 'os';
import 'path';
import './vendor/index.xL8XjTLv.js';
import 'util';
import 'stream';
import 'events';
import 'fs';
import 'picocolors';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import '@vitest/runner/utils';
import './vendor/base.5NT-gWu5.js';
import '@vitest/utils';
import './vendor/env.AtSIuHFg.js';
import 'std-env';
import './path.js';
import './vendor/index.8bPxjt7g.js';
import 'zlib';
import 'buffer';
import 'crypto';
import 'https';
import 'http';
import 'net';
import 'tls';
import 'url';
import '@vitest/utils/source-map';
import 'node:crypto';
import 'node:v8';
import 'node:os';
import 'node:events';
import 'tinypool';
import 'node:fs/promises';
import 'local-pkg';
import 'vite-node/utils';
import 'magic-string';
import 'acorn-walk';
import '@vitest/utils/ast';
import 'strip-literal';
import './vendor/utils.dEtNIEgr.js';
import 'node:module';
import './vendor/index.SMVOaj7F.js';
import './vendor/global.CkGT_TMy.js';
import 'node:readline';
import 'readline';
import './vendor/tasks.IknbGB2n.js';
import 'node:perf_hooks';
import './chunks/runtime-console.EO5ha7qv.js';
import 'node:stream';
import './vendor/date.Ns1pGd_X.js';
import 'execa';
import 'module';
import 'assert';

7
control-plane-ui/node_modules/vitest/dist/path.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import url from 'node:url';
import { resolve } from 'pathe';
const rootDir = resolve(url.fileURLToPath(import.meta.url), "../../");
const distDir = resolve(url.fileURLToPath(import.meta.url), "../../dist");
export { distDir, rootDir };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
export { aS as BaseReporter, aJ as BasicReporter, a_ as BenchmarkBuiltinReporters, aZ as BenchmarkReportsMap, aV as BuiltinReporterOptions, aU as BuiltinReporters, aI as DefaultReporter, aK as DotReporter, aR as GithubActionsReporter, aQ as HangingProcessReporter, aO as JUnitReporter, aW as JsonAssertionResult, aL as JsonReporter, aX as JsonTestResult, aY as JsonTestResults, v as Reporter, aT as ReportersMap, aP as TapFlatReporter, aN as TapReporter, aM as VerboseReporter } from './reporters-w_64AS5f.js';
import 'vite';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';

36
control-plane-ui/node_modules/vitest/dist/reporters.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
export { a as BasicReporter, e as BenchmarkReportsMap, D as DefaultReporter, b as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, c as JUnitReporter, J as JsonReporter, R as ReportersMap, d as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/index.-xs08BYx.js';
import 'node:fs';
import 'picocolors';
import 'pathe';
import './vendor/tasks.IknbGB2n.js';
import '@vitest/runner/utils';
import '@vitest/utils';
import './vendor/env.AtSIuHFg.js';
import 'std-env';
import './vendor/utils.dEtNIEgr.js';
import './vendor/base.5NT-gWu5.js';
import 'node:perf_hooks';
import './vendor/index.SMVOaj7F.js';
import './vendor/global.CkGT_TMy.js';
import './chunks/runtime-console.EO5ha7qv.js';
import 'node:stream';
import 'node:console';
import 'node:path';
import './vendor/date.Ns1pGd_X.js';
import '@vitest/utils/source-map';
import 'node:os';
import 'node:fs/promises';
import 'execa';
import 'node:url';
import 'path';
import 'fs';
import 'module';
import 'vite';
import 'acorn-walk';
import 'node:process';
import './vendor/_commonjsHelpers.jjO7Zipk.js';
import 'assert';
import 'events';
import 'node:crypto';
import 'vite-node/utils';
import 'node:module';

48
control-plane-ui/node_modules/vitest/dist/runners.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
import { VitestRunner, VitestRunnerImportSource, Suite, Task, CancelReason, Test, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
import { R as ResolvedConfig } from './reporters-w_64AS5f.js';
import * as tinybench from 'tinybench';
import 'vite';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import '@vitest/utils';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
declare class VitestTestRunner implements VitestRunner {
config: ResolvedConfig;
private snapshotClient;
private workerState;
private __vitest_executor;
private cancelRun;
constructor(config: ResolvedConfig);
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
onBeforeRunFiles(): void;
onAfterRunFiles(): void;
onAfterRunSuite(suite: Suite): Promise<void>;
onAfterRunTask(test: Task): void;
onCancel(_reason: CancelReason): void;
onBeforeRunTask(test: Task): Promise<void>;
onBeforeRunSuite(suite: Suite): Promise<void>;
onBeforeTryTask(test: Task): void;
onAfterTryTask(test: Task): void;
extendTaskContext<T extends Test | Custom>(context: TaskContext<T>): ExtendedContext<T>;
}
declare class NodeBenchmarkRunner implements VitestRunner {
config: ResolvedConfig;
private __vitest_executor;
constructor(config: ResolvedConfig);
importTinybench(): Promise<typeof tinybench>;
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
runSuite(suite: Suite): Promise<void>;
runTask(): Promise<void>;
}
export { NodeBenchmarkRunner, VitestTestRunner };

257
control-plane-ui/node_modules/vitest/dist/runners.js generated vendored Normal file
View File

@@ -0,0 +1,257 @@
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.YFlodzP_.js';
import 'pathe';
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
import { createDefer, getSafeTimers } from '@vitest/utils';
import { g as getWorkerState } from './vendor/global.CkGT_TMy.js';
import './vendor/env.AtSIuHFg.js';
import { r as rpc } from './vendor/rpc.joBhAkyK.js';
import { getTests, getNames } from '@vitest/runner/utils';
import { updateTask } from '@vitest/runner';
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.yGkUTKnC.js';
import 'chai';
import './vendor/_commonjsHelpers.jjO7Zipk.js';
import '@vitest/snapshot';
import '@vitest/utils/error';
import '@vitest/utils/source-map';
import './vendor/base.5NT-gWu5.js';
import './vendor/date.Ns1pGd_X.js';
import '@vitest/spy';
import 'std-env';
import './vendor/index.8bPxjt7g.js';
import './vendor/index.SMVOaj7F.js';
class VitestTestRunner {
constructor(config) {
this.config = config;
}
snapshotClient = getSnapshotClient();
workerState = getWorkerState();
__vitest_executor;
cancelRun = false;
importFile(filepath, source) {
if (source === "setup")
this.workerState.moduleCache.delete(filepath);
return this.__vitest_executor.executeId(filepath);
}
onBeforeRunFiles() {
this.snapshotClient.clear();
}
onAfterRunFiles() {
this.workerState.current = void 0;
}
async onAfterRunSuite(suite) {
if (this.config.logHeapUsage && typeof process !== "undefined")
suite.result.heap = process.memoryUsage().heapUsed;
if (suite.mode !== "skip" && typeof suite.filepath !== "undefined") {
for (const test of getTests(suite)) {
if (test.mode === "skip") {
const name = getNames(test).slice(1).join(" > ");
this.snapshotClient.skipTestSnapshots(name);
}
}
const result = await this.snapshotClient.finishCurrentRun();
if (result)
await rpc().snapshotSaved(result);
}
this.workerState.current = suite.suite;
}
onAfterRunTask(test) {
this.snapshotClient.clearTest();
if (this.config.logHeapUsage && typeof process !== "undefined")
test.result.heap = process.memoryUsage().heapUsed;
this.workerState.current = test.suite;
}
onCancel(_reason) {
this.cancelRun = true;
}
async onBeforeRunTask(test) {
if (this.cancelRun)
test.mode = "skip";
if (test.mode !== "run")
return;
clearModuleMocks(this.config);
this.workerState.current = test;
}
async onBeforeRunSuite(suite) {
if (this.cancelRun)
suite.mode = "skip";
if (suite.mode !== "skip" && typeof suite.filepath !== "undefined") {
await this.snapshotClient.startCurrentRun(suite.filepath, "__default_name_", this.workerState.config.snapshotOptions);
}
this.workerState.current = suite;
}
onBeforeTryTask(test) {
var _a, _b;
setState({
assertionCalls: 0,
isExpectingAssertions: false,
isExpectingAssertionsError: null,
expectedAssertionsNumber: null,
expectedAssertionsNumberErrorGen: null,
testPath: (_b = (_a = test.suite) == null ? void 0 : _a.file) == null ? void 0 : _b.filepath,
currentTestName: getFullName(test),
snapshotState: this.snapshotClient.snapshotState
}, globalThis[GLOBAL_EXPECT]);
}
onAfterTryTask(test) {
const {
assertionCalls,
expectedAssertionsNumber,
expectedAssertionsNumberErrorGen,
isExpectingAssertions,
isExpectingAssertionsError
// @ts-expect-error _local is untyped
} = "context" in test && test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
throw expectedAssertionsNumberErrorGen();
if (isExpectingAssertions === true && assertionCalls === 0)
throw isExpectingAssertionsError;
}
extendTaskContext(context) {
let _expect;
Object.defineProperty(context, "expect", {
get() {
if (!_expect)
_expect = createExpect(context.task);
return _expect;
}
});
Object.defineProperty(context, "_local", {
get() {
return _expect != null;
}
});
return context;
}
}
function clearModuleMocks(config) {
const { clearMocks, mockReset, restoreMocks, unstubEnvs, unstubGlobals } = config;
if (restoreMocks)
vi.restoreAllMocks();
else if (mockReset)
vi.resetAllMocks();
else if (clearMocks)
vi.clearAllMocks();
if (unstubEnvs)
vi.unstubAllEnvs();
if (unstubGlobals)
vi.unstubAllGlobals();
}
function createBenchmarkResult(name) {
return {
name,
rank: 0,
rme: 0,
samples: []
};
}
const benchmarkTasks = /* @__PURE__ */ new WeakMap();
async function runBenchmarkSuite(suite, runner) {
var _a;
const { Task, Bench } = await runner.importTinybench();
const start = performance.now();
const benchmarkGroup = [];
const benchmarkSuiteGroup = [];
for (const task of suite.tasks) {
if (task.mode !== "run")
continue;
if ((_a = task.meta) == null ? void 0 : _a.benchmark)
benchmarkGroup.push(task);
else if (task.type === "suite")
benchmarkSuiteGroup.push(task);
}
for (const subSuite of benchmarkSuiteGroup)
await runBenchmarkSuite(subSuite, runner);
if (benchmarkGroup.length) {
const defer = createDefer();
suite.result = {
state: "run",
startTime: start,
benchmark: createBenchmarkResult(suite.name)
};
updateTask$1(suite);
const addBenchTaskListener = (task, benchmark) => {
task.addEventListener("complete", (e) => {
const task2 = e.task;
const taskRes = task2.result;
const result = benchmark.result.benchmark;
Object.assign(result, taskRes);
updateTask$1(benchmark);
}, {
once: true
});
task.addEventListener("error", (e) => {
const task2 = e.task;
defer.reject(benchmark ? task2.result.error : e);
}, {
once: true
});
};
benchmarkGroup.forEach((benchmark) => {
const options = getBenchOptions(benchmark);
const benchmarkInstance = new Bench(options);
const benchmarkFn = getBenchFn(benchmark);
benchmark.result = {
state: "run",
startTime: start,
benchmark: createBenchmarkResult(benchmark.name)
};
const task = new Task(benchmarkInstance, benchmark.name, benchmarkFn);
benchmarkTasks.set(benchmark, task);
addBenchTaskListener(task, benchmark);
updateTask$1(benchmark);
});
const { setTimeout } = getSafeTimers();
const tasks = [];
for (const benchmark of benchmarkGroup) {
const task = benchmarkTasks.get(benchmark);
await task.warmup();
tasks.push([
await new Promise((resolve) => setTimeout(async () => {
resolve(await task.run());
})),
benchmark
]);
}
suite.result.duration = performance.now() - start;
suite.result.state = "pass";
tasks.sort(([taskA], [taskB]) => taskA.result.mean - taskB.result.mean).forEach(([, benchmark], idx) => {
benchmark.result.state = "pass";
if (benchmark) {
const result = benchmark.result.benchmark;
result.rank = Number(idx) + 1;
updateTask$1(benchmark);
}
});
updateTask$1(suite);
defer.resolve(null);
await defer;
}
function updateTask$1(task) {
updateTask(task, runner);
}
}
class NodeBenchmarkRunner {
constructor(config) {
this.config = config;
}
__vitest_executor;
async importTinybench() {
return await import('tinybench');
}
importFile(filepath, source) {
if (source === "setup")
getWorkerState().moduleCache.delete(filepath);
return this.__vitest_executor.executeId(filepath);
}
async runSuite(suite) {
await runBenchmarkSuite(suite, this);
}
async runTask() {
throw new Error("`test()` and `it()` is only available in test mode.");
}
}
export { NodeBenchmarkRunner, VitestTestRunner };

View File

@@ -0,0 +1,9 @@
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
export { SnapshotEnvironment } from '@vitest/snapshot/environment';
declare class VitestNodeSnapshotEnvironment extends NodeSnapshotEnvironment {
getHeader(): string;
resolvePath(filepath: string): Promise<string>;
}
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment };

View File

@@ -0,0 +1,8 @@
export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from './chunks/environments-node.vcoXCoKs.js';
import '@vitest/snapshot/environment';
import 'pathe';
import '@vitest/runner/utils';
import '@vitest/utils';
import './vendor/global.CkGT_TMy.js';
import './vendor/env.AtSIuHFg.js';
import 'std-env';

1
control-plane-ui/node_modules/vitest/dist/spy.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '@vitest/spy';

View File

@@ -0,0 +1,10 @@
import { Custom } from '@vitest/runner';
import '@vitest/runner/utils';
import { ap as BenchFunction, aq as BenchmarkAPI } from './reporters-w_64AS5f.js';
import { Options } from 'tinybench';
declare function getBenchOptions(key: Custom): Options;
declare function getBenchFn(key: Custom): BenchFunction;
declare const bench: BenchmarkAPI;
export { getBenchOptions as a, bench as b, getBenchFn as g };

17
control-plane-ui/node_modules/vitest/dist/suite.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
export { createChainable } from '@vitest/runner/utils';
export { g as getBenchFn, a as getBenchOptions } from './suite-dWqIFb_-.js';
import './reporters-w_64AS5f.js';
import 'vite';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';

9
control-plane-ui/node_modules/vitest/dist/suite.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export { createTaskCollector, getCurrentSuite, getCurrentTest, getFn, getHooks, setFn, setHooks } from '@vitest/runner';
export { createChainable } from '@vitest/runner/utils';
export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.yGkUTKnC.js';
import '@vitest/utils';
import './vendor/index.SMVOaj7F.js';
import 'pathe';
import './vendor/global.CkGT_TMy.js';
import './vendor/env.AtSIuHFg.js';
import 'std-env';

6
control-plane-ui/node_modules/vitest/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import * as _vitest_utils_source_map from '@vitest/utils/source-map';
export * from '@vitest/utils';
declare function loadSourceMapUtils(): Promise<typeof _vitest_utils_source_map>;
export { loadSourceMapUtils };

7
control-plane-ui/node_modules/vitest/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export * from '@vitest/utils';
function loadSourceMapUtils() {
return import('@vitest/utils/source-map');
}
export { loadSourceMapUtils };

View File

@@ -0,0 +1,7 @@
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
export { commonjsGlobal as c, getDefaultExportFromCjs as g };

View File

@@ -0,0 +1,119 @@
import '@vitest/utils';
function collectOwnProperties(obj, collector) {
const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
Object.getOwnPropertyNames(obj).forEach(collect);
Object.getOwnPropertySymbols(obj).forEach(collect);
}
function groupBy(collection, iteratee) {
return collection.reduce((acc, item) => {
const key = iteratee(item);
acc[key] || (acc[key] = []);
acc[key].push(item);
return acc;
}, {});
}
function isPrimitive(value) {
return value === null || typeof value !== "function" && typeof value !== "object";
}
function getAllMockableProperties(obj, isModule, constructors) {
const {
Map,
Object: Object2,
Function,
RegExp: RegExp2,
Array: Array2
} = constructors;
const allProps = new Map();
let curr = obj;
do {
if (curr === Object2.prototype || curr === Function.prototype || curr === RegExp2.prototype)
break;
collectOwnProperties(curr, (key) => {
const descriptor = Object2.getOwnPropertyDescriptor(curr, key);
if (descriptor)
allProps.set(key, { key, descriptor });
});
} while (curr = Object2.getPrototypeOf(curr));
if (isModule && !allProps.has("default") && "default" in obj) {
const descriptor = Object2.getOwnPropertyDescriptor(obj, "default");
if (descriptor)
allProps.set("default", { key: "default", descriptor });
}
return Array2.from(allProps.values());
}
function slash(str) {
return str.replace(/\\/g, "/");
}
function noop() {
}
function toArray(array) {
if (array === null || array === void 0)
array = [];
if (Array.isArray(array))
return array;
return [array];
}
function toString(v) {
return Object.prototype.toString.call(v);
}
function isPlainObject(val) {
return toString(val) === "[object Object]" && (!val.constructor || val.constructor.name === "Object");
}
function deepMerge(target, ...sources) {
if (!sources.length)
return target;
const source = sources.shift();
if (source === void 0)
return target;
if (isMergeableObject(target) && isMergeableObject(source)) {
Object.keys(source).forEach((key) => {
if (isMergeableObject(source[key])) {
if (!target[key])
target[key] = {};
deepMerge(target[key], source[key]);
} else {
target[key] = source[key];
}
});
}
return deepMerge(target, ...sources);
}
function isMergeableObject(item) {
return isPlainObject(item) && !Array.isArray(item);
}
function stdout() {
return console._stdout || process.stdout;
}
class AggregateErrorPonyfill extends Error {
errors;
constructor(errors, message = "") {
super(message);
this.errors = [...errors];
}
}
function isChildProcess() {
return typeof process !== "undefined" && !!process.send;
}
function setProcessTitle(title) {
try {
process.title = `node (${title})`;
} catch {
}
}
function escapeRegExp(s) {
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function wildcardPatternToRegExp(pattern) {
return new RegExp(`^${pattern.split("*").map(escapeRegExp).join(".*")}$`, "i");
}
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
function nanoid(size = 21) {
let id = "";
let i = size;
while (i--)
id += urlAlphabet[Math.random() * 64 | 0];
return id;
}
export { AggregateErrorPonyfill as A, slash as a, isPrimitive as b, groupBy as c, deepMerge as d, nanoid as e, stdout as f, getAllMockableProperties as g, isChildProcess as i, noop as n, setProcessTitle as s, toArray as t, wildcardPatternToRegExp as w };

View File

@@ -0,0 +1,38 @@
import { ModuleCacheMap } from 'vite-node/client';
import { p as provideWorkerState } from './global.CkGT_TMy.js';
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.fL3szUAI.js';
let _viteNode;
const moduleCache = new ModuleCacheMap();
const mockMap = /* @__PURE__ */ new Map();
async function startViteNode(options) {
if (_viteNode)
return _viteNode;
_viteNode = await startVitestExecutor(options);
return _viteNode;
}
async function runBaseTests(state) {
const { ctx } = state;
state.moduleCache = moduleCache;
state.mockMap = mockMap;
provideWorkerState(globalThis, state);
if (ctx.invalidates) {
ctx.invalidates.forEach((fsPath) => {
moduleCache.delete(fsPath);
moduleCache.delete(`mock:${fsPath}`);
});
}
ctx.files.forEach((i) => state.moduleCache.delete(i));
const [executor, { run }] = await Promise.all([
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
import('../chunks/runtime-runBaseTests.oAvMKtQC.js')
]);
await run(
ctx.files,
ctx.config,
{ environment: state.environment, options: ctx.environment.options },
executor
);
}
export { runBaseTests as r };

View File

@@ -0,0 +1,41 @@
import { getCurrentSuite } from '@vitest/runner';
import { createChainable } from '@vitest/runner/utils';
import { noop } from '@vitest/utils';
import { i as isRunningInBenchmark } from './index.SMVOaj7F.js';
const benchFns = /* @__PURE__ */ new WeakMap();
const benchOptsMap = /* @__PURE__ */ new WeakMap();
function getBenchOptions(key) {
return benchOptsMap.get(key);
}
function getBenchFn(key) {
return benchFns.get(key);
}
const bench = createBenchmark(
function(name, fn = noop, options = {}) {
if (!isRunningInBenchmark())
throw new Error("`bench()` is only available in benchmark mode.");
const task = getCurrentSuite().task(formatName(name), {
...this,
meta: {
benchmark: true
}
});
benchFns.set(task, fn);
benchOptsMap.set(task, options);
}
);
function createBenchmark(fn) {
const benchmark = createChainable(
["skip", "only", "todo"],
fn
);
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
return benchmark;
}
function formatName(name) {
return typeof name === "string" ? name : name instanceof Function ? name.name || "<anonymous>" : String(name);
}
export { getBenchOptions as a, bench as b, getBenchFn as g };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
const defaultPort = 51204;
const defaultBrowserPort = 63315;
const defaultInspectPort = 9229;
const EXIT_CODE_RESTART = 43;
const API_PATH = "/__vitest_api__";
const extraInlineDeps = [
/^(?!.*(?:node_modules)).*\.mjs$/,
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
// Vite client
/vite\w*\/dist\/client\/env.mjs/,
// Nuxt
"@nuxt/test-utils"
];
const CONFIG_NAMES = [
"vitest.config",
"vite.config"
];
const WORKSPACES_NAMES = [
"vitest.workspace",
"vitest.projects"
];
const CONFIG_EXTENSIONS = [
".ts",
".mts",
".cts",
".js",
".mjs",
".cjs"
];
const configFiles = CONFIG_NAMES.flatMap(
(name) => CONFIG_EXTENSIONS.map((ext) => name + ext)
);
const WORKSPACES_EXTENSIONS = [
...CONFIG_EXTENSIONS,
".json"
];
const workspacesFiles = WORKSPACES_NAMES.flatMap(
(name) => WORKSPACES_EXTENSIONS.map((ext) => name + ext)
);
const globalApis = [
// suite
"suite",
"test",
"describe",
"it",
// chai
"chai",
"expect",
"assert",
// typecheck
"expectTypeOf",
"assertType",
// utils
"vitest",
"vi",
// hooks
"beforeAll",
"afterAll",
"beforeEach",
"afterEach",
"onTestFinished",
"onTestFailed"
];
export { API_PATH as A, CONFIG_NAMES as C, EXIT_CODE_RESTART as E, defaultBrowserPort as a, defaultInspectPort as b, configFiles as c, defaultPort as d, extraInlineDeps as e, globalApis as g, workspacesFiles as w };

View File

@@ -0,0 +1,53 @@
const CoverageProviderMap = {
v8: "@vitest/coverage-v8",
istanbul: "@vitest/coverage-istanbul"
};
async function resolveCoverageProviderModule(options, loader) {
if (!(options == null ? void 0 : options.enabled) || !options.provider)
return null;
const provider = options.provider;
if (provider === "v8" || provider === "istanbul") {
const { default: coverageModule } = await loader.executeId(CoverageProviderMap[provider]);
if (!coverageModule)
throw new Error(`Failed to load ${CoverageProviderMap[provider]}. Default export is missing.`);
return coverageModule;
}
let customProviderModule;
try {
customProviderModule = await loader.executeId(options.customProviderModule);
} catch (error) {
throw new Error(`Failed to load custom CoverageProviderModule from ${options.customProviderModule}`, { cause: error });
}
if (customProviderModule.default == null)
throw new Error(`Custom CoverageProviderModule loaded from ${options.customProviderModule} was not the default export`);
return customProviderModule.default;
}
async function getCoverageProvider(options, loader) {
const coverageModule = await resolveCoverageProviderModule(options, loader);
if (coverageModule)
return coverageModule.getProvider();
return null;
}
async function startCoverageInsideWorker(options, loader) {
var _a;
const coverageModule = await resolveCoverageProviderModule(options, loader);
if (coverageModule)
return (_a = coverageModule.startCoverage) == null ? void 0 : _a.call(coverageModule);
return null;
}
async function takeCoverageInsideWorker(options, loader) {
var _a;
const coverageModule = await resolveCoverageProviderModule(options, loader);
if (coverageModule)
return (_a = coverageModule.takeCoverage) == null ? void 0 : _a.call(coverageModule);
return null;
}
async function stopCoverageInsideWorker(options, loader) {
var _a;
const coverageModule = await resolveCoverageProviderModule(options, loader);
if (coverageModule)
return (_a = coverageModule.stopCoverage) == null ? void 0 : _a.call(coverageModule);
return null;
}
export { CoverageProviderMap as C, startCoverageInsideWorker as a, getCoverageProvider as g, stopCoverageInsideWorker as s, takeCoverageInsideWorker as t };

View File

@@ -0,0 +1,51 @@
const RealDate = Date;
let now = null;
class MockDate extends RealDate {
constructor(y, m, d, h, M, s, ms) {
super();
let date;
switch (arguments.length) {
case 0:
if (now !== null)
date = new RealDate(now.valueOf());
else
date = new RealDate();
break;
case 1:
date = new RealDate(y);
break;
default:
d = typeof d === "undefined" ? 1 : d;
h = h || 0;
M = M || 0;
s = s || 0;
ms = ms || 0;
date = new RealDate(y, m, d, h, M, s, ms);
break;
}
Object.setPrototypeOf(date, MockDate.prototype);
return date;
}
}
MockDate.UTC = RealDate.UTC;
MockDate.now = function() {
return new MockDate().valueOf();
};
MockDate.parse = function(dateString) {
return RealDate.parse(dateString);
};
MockDate.toString = function() {
return RealDate.toString();
};
function mockDate(date) {
const dateObj = new RealDate(date.valueOf());
if (Number.isNaN(dateObj.getTime()))
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
globalThis.Date = MockDate;
now = dateObj.valueOf();
}
function resetDate() {
globalThis.Date = RealDate;
}
export { RealDate as R, mockDate as m, resetDate as r };

View File

@@ -0,0 +1,7 @@
import 'std-env';
var _a;
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
const isWindows = isNode && process.platform === "win32";
export { isWindows as a, isNode as i };

View File

@@ -0,0 +1,594 @@
import vm from 'node:vm';
import { pathToFileURL } from 'node:url';
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { ViteNodeRunner, DEFAULT_REQUEST_STUBS } from 'vite-node/client';
import { isNodeBuiltin, isInternalRequest, toFilePath, isPrimitive } from 'vite-node/utils';
import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relative } from 'pathe';
import { processError } from '@vitest/utils/error';
import { distDir } from '../path.js';
import { highlight, getType } from '@vitest/utils';
import { g as getAllMockableProperties } from './base.5NT-gWu5.js';
const spyModulePath = resolve(distDir, "spy.js");
class RefTracker {
idMap = /* @__PURE__ */ new Map();
mockedValueMap = /* @__PURE__ */ new Map();
getId(value) {
return this.idMap.get(value);
}
getMockedValue(id) {
return this.mockedValueMap.get(id);
}
track(originalValue, mockedValue) {
const newId = this.idMap.size;
this.idMap.set(originalValue, newId);
this.mockedValueMap.set(newId, mockedValue);
return newId;
}
}
function isSpecialProp(prop, parentType) {
return parentType.includes("Function") && typeof prop === "string" && ["arguments", "callee", "caller", "length", "name"].includes(prop);
}
class VitestMocker {
constructor(executor) {
this.executor = executor;
const context = this.executor.options.context;
if (context)
this.primitives = vm.runInContext("({ Object, Error, Function, RegExp, Symbol, Array, Map })", context);
else
this.primitives = { Object, Error, Function, RegExp, Symbol: globalThis.Symbol, Array, Map };
const Symbol2 = this.primitives.Symbol;
this.filterPublicKeys = ["__esModule", Symbol2.asyncIterator, Symbol2.hasInstance, Symbol2.isConcatSpreadable, Symbol2.iterator, Symbol2.match, Symbol2.matchAll, Symbol2.replace, Symbol2.search, Symbol2.split, Symbol2.species, Symbol2.toPrimitive, Symbol2.toStringTag, Symbol2.unscopables];
}
static pendingIds = [];
spyModule;
resolveCache = /* @__PURE__ */ new Map();
primitives;
filterPublicKeys;
mockContext = {
callstack: null
};
get root() {
return this.executor.options.root;
}
get mockMap() {
return this.executor.options.mockMap;
}
get moduleCache() {
return this.executor.moduleCache;
}
get moduleDirectories() {
return this.executor.options.moduleDirectories || [];
}
async initializeSpyModule() {
this.spyModule = await this.executor.executeId(spyModulePath);
}
deleteCachedItem(id) {
const mockId = this.getMockPath(id);
if (this.moduleCache.has(mockId))
this.moduleCache.delete(mockId);
}
isAModuleDirectory(path) {
return this.moduleDirectories.some((dir) => path.includes(dir));
}
getSuiteFilepath() {
return this.executor.state.filepath || "global";
}
createError(message, codeFrame) {
const Error2 = this.primitives.Error;
const error = new Error2(message);
Object.assign(error, { codeFrame });
return error;
}
getMocks() {
const suite = this.getSuiteFilepath();
const suiteMocks = this.mockMap.get(suite);
const globalMocks = this.mockMap.get("global");
return {
...globalMocks,
...suiteMocks
};
}
async resolvePath(rawId, importer) {
let id;
let fsPath;
try {
[id, fsPath] = await this.executor.originalResolveUrl(rawId, importer);
} catch (error) {
if (error.code === "ERR_MODULE_NOT_FOUND") {
const { id: unresolvedId } = error[Symbol.for("vitest.error.not_found.data")];
id = unresolvedId;
fsPath = unresolvedId;
} else {
throw error;
}
}
const external = !isAbsolute(fsPath) || this.isAModuleDirectory(fsPath) ? rawId : null;
return {
id,
fsPath,
external
};
}
async resolveMocks() {
if (!VitestMocker.pendingIds.length)
return;
await Promise.all(VitestMocker.pendingIds.map(async (mock) => {
const { fsPath, external } = await this.resolvePath(mock.id, mock.importer);
if (mock.type === "unmock")
this.unmockPath(fsPath);
if (mock.type === "mock")
this.mockPath(mock.id, fsPath, external, mock.factory);
}));
VitestMocker.pendingIds = [];
}
async callFunctionMock(dep, mock) {
var _a, _b;
const cached = (_a = this.moduleCache.get(dep)) == null ? void 0 : _a.exports;
if (cached)
return cached;
let exports;
try {
exports = await mock();
} catch (err) {
const vitestError = this.createError(
'[vitest] There was an error when mocking a module. If you are using "vi.mock" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Read more: https://vitest.dev/api/vi.html#vi-mock'
);
vitestError.cause = err;
throw vitestError;
}
const filepath = dep.slice(5);
const mockpath = ((_b = this.resolveCache.get(this.getSuiteFilepath())) == null ? void 0 : _b[filepath]) || filepath;
if (exports === null || typeof exports !== "object")
throw this.createError(`[vitest] vi.mock("${mockpath}", factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?`);
const moduleExports = new Proxy(exports, {
get: (target, prop) => {
const val = target[prop];
if (prop === "then") {
if (target instanceof Promise)
return target.then.bind(target);
} else if (!(prop in target)) {
if (this.filterPublicKeys.includes(prop))
return void 0;
throw this.createError(
`[vitest] No "${String(prop)}" export is defined on the "${mockpath}" mock. Did you forget to return it from "vi.mock"?
If you need to partially mock a module, you can use "importOriginal" helper inside:
`,
highlight(`vi.mock("${mockpath}", async (importOriginal) => {
const actual = await importOriginal()
return {
...actual,
// your mocked methods
}
})`)
);
}
return val;
}
});
this.moduleCache.set(dep, { exports: moduleExports });
return moduleExports;
}
getMockContext() {
return this.mockContext;
}
getMockPath(dep) {
return `mock:${dep}`;
}
getDependencyMock(id) {
return this.getMocks()[id];
}
normalizePath(path) {
return this.moduleCache.normalizePath(path);
}
resolveMockPath(mockPath, external) {
const path = external || mockPath;
if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
const mockDirname = dirname(path);
const mockFolder = join(this.root, "__mocks__", mockDirname);
if (!existsSync(mockFolder))
return null;
const files = readdirSync(mockFolder);
const baseOriginal = basename(path);
for (const file of files) {
const baseFile = basename(file, extname(file));
if (baseFile === baseOriginal)
return resolve(mockFolder, file);
}
return null;
}
const dir = dirname(path);
const baseId = basename(path);
const fullPath = resolve(dir, "__mocks__", baseId);
return existsSync(fullPath) ? fullPath : null;
}
mockObject(object, mockExports = {}) {
const finalizers = new Array();
const refs = new RefTracker();
const define = (container, key, value) => {
try {
container[key] = value;
return true;
} catch {
return false;
}
};
const mockPropertiesOf = (container, newContainer) => {
const containerType = getType(container);
const isModule = containerType === "Module" || !!container.__esModule;
for (const { key: property, descriptor } of getAllMockableProperties(container, isModule, this.primitives)) {
if (!isModule && descriptor.get) {
try {
Object.defineProperty(newContainer, property, descriptor);
} catch (error) {
}
continue;
}
if (isSpecialProp(property, containerType))
continue;
const value = container[property];
const refId = refs.getId(value);
if (refId !== void 0) {
finalizers.push(() => define(newContainer, property, refs.getMockedValue(refId)));
continue;
}
const type = getType(value);
if (Array.isArray(value)) {
define(newContainer, property, []);
continue;
}
const isFunction = type.includes("Function") && typeof value === "function";
if ((!isFunction || value.__isMockFunction) && type !== "Object" && type !== "Module") {
define(newContainer, property, value);
continue;
}
if (!define(newContainer, property, isFunction ? value : {}))
continue;
if (isFunction) {
let mockFunction2 = function() {
if (this instanceof newContainer[property]) {
for (const { key, descriptor: descriptor2 } of getAllMockableProperties(this, false, primitives)) {
if (descriptor2.get)
continue;
const value2 = this[key];
const type2 = getType(value2);
const isFunction2 = type2.includes("Function") && typeof value2 === "function";
if (isFunction2) {
const original = this[key];
const mock2 = spyModule.spyOn(this, key).mockImplementation(original);
mock2.mockRestore = () => {
mock2.mockReset();
mock2.mockImplementation(original);
return mock2;
};
}
}
}
};
if (!this.spyModule)
throw this.createError("[vitest] `spyModule` is not defined. This is Vitest error. Please open a new issue with reproduction.");
const spyModule = this.spyModule;
const primitives = this.primitives;
const mock = spyModule.spyOn(newContainer, property).mockImplementation(mockFunction2);
mock.mockRestore = () => {
mock.mockReset();
mock.mockImplementation(mockFunction2);
return mock;
};
Object.defineProperty(newContainer[property], "length", { value: 0 });
}
refs.track(value, newContainer[property]);
mockPropertiesOf(value, newContainer[property]);
}
};
const mockedObject = mockExports;
mockPropertiesOf(object, mockedObject);
for (const finalizer of finalizers)
finalizer();
return mockedObject;
}
unmockPath(path) {
const suitefile = this.getSuiteFilepath();
const id = this.normalizePath(path);
const mock = this.mockMap.get(suitefile);
if (mock && id in mock)
delete mock[id];
this.deleteCachedItem(id);
}
mockPath(originalId, path, external, factory) {
const id = this.normalizePath(path);
const suitefile = this.getSuiteFilepath();
const mocks = this.mockMap.get(suitefile) || {};
const resolves = this.resolveCache.get(suitefile) || {};
mocks[id] = factory || this.resolveMockPath(path, external);
resolves[id] = originalId;
this.mockMap.set(suitefile, mocks);
this.resolveCache.set(suitefile, resolves);
this.deleteCachedItem(id);
}
async importActual(rawId, importer, callstack) {
const { id, fsPath } = await this.resolvePath(rawId, importer);
const result = await this.executor.cachedRequest(id, fsPath, callstack || [importer]);
return result;
}
async importMock(rawId, importee) {
const { id, fsPath, external } = await this.resolvePath(rawId, importee);
const normalizedId = this.normalizePath(fsPath);
let mock = this.getDependencyMock(normalizedId);
if (mock === void 0)
mock = this.resolveMockPath(fsPath, external);
if (mock === null) {
const mod = await this.executor.cachedRequest(id, fsPath, [importee]);
return this.mockObject(mod);
}
if (typeof mock === "function")
return this.callFunctionMock(fsPath, mock);
return this.executor.dependencyRequest(mock, mock, [importee]);
}
async requestWithMock(url, callstack) {
const id = this.normalizePath(url);
const mock = this.getDependencyMock(id);
const mockPath = this.getMockPath(id);
if (mock === null) {
const cache = this.moduleCache.get(mockPath);
if (cache.exports)
return cache.exports;
const exports = {};
this.moduleCache.set(mockPath, { exports });
const mod = await this.executor.directRequest(url, url, callstack);
this.mockObject(mod, exports);
return exports;
}
if (typeof mock === "function" && !callstack.includes(mockPath) && !callstack.includes(url)) {
try {
callstack.push(mockPath);
this.mockContext.callstack = callstack;
return await this.callFunctionMock(mockPath, mock);
} finally {
this.mockContext.callstack = null;
const indexMock = callstack.indexOf(mockPath);
callstack.splice(indexMock, 1);
}
}
if (typeof mock === "string" && !callstack.includes(mock))
return mock;
}
queueMock(id, importer, factory, throwIfCached = false) {
VitestMocker.pendingIds.push({ type: "mock", id, importer, factory, throwIfCached });
}
queueUnmock(id, importer, throwIfCached = false) {
VitestMocker.pendingIds.push({ type: "unmock", id, importer, throwIfCached });
}
}
async function createVitestExecutor(options) {
const runner = new VitestExecutor(options);
await runner.executeId("/@vite/env");
await runner.mocker.initializeSpyModule();
return runner;
}
const externalizeMap = /* @__PURE__ */ new Map();
const bareVitestRegexp = /^@?vitest(\/|$)/;
const dispose = [];
function listenForErrors(state) {
dispose.forEach((fn) => fn());
dispose.length = 0;
function catchError(err, type) {
var _a;
const worker = state();
const error = processError(err);
if (!isPrimitive(error)) {
error.VITEST_TEST_NAME = (_a = worker.current) == null ? void 0 : _a.name;
if (worker.filepath)
error.VITEST_TEST_PATH = relative(state().config.root, worker.filepath);
error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
}
state().rpc.onUnhandledError(error, type);
}
const uncaughtException = (e) => catchError(e, "Uncaught Exception");
const unhandledRejection = (e) => catchError(e, "Unhandled Rejection");
process.on("uncaughtException", uncaughtException);
process.on("unhandledRejection", unhandledRejection);
dispose.push(() => {
process.off("uncaughtException", uncaughtException);
process.off("unhandledRejection", unhandledRejection);
});
}
async function startVitestExecutor(options) {
const state = () => globalThis.__vitest_worker__ || options.state;
const rpc = () => state().rpc;
process.exit = (code = process.exitCode || 0) => {
throw new Error(`process.exit unexpectedly called with "${code}"`);
};
listenForErrors(state);
const getTransformMode = () => {
return state().environment.transformMode ?? "ssr";
};
return await createVitestExecutor({
async fetchModule(id) {
if (externalizeMap.has(id))
return { externalize: externalizeMap.get(id) };
if (id.includes(distDir)) {
const { path } = toFilePath(id, state().config.root);
const externalize = pathToFileURL(path).toString();
externalizeMap.set(id, externalize);
return { externalize };
}
if (bareVitestRegexp.test(id)) {
externalizeMap.set(id, id);
return { externalize: id };
}
const result = await rpc().fetch(id, getTransformMode());
if (result.id && !result.externalize) {
const code = readFileSync(result.id, "utf-8");
return { code };
}
return result;
},
resolveId(id, importer) {
return rpc().resolveId(id, importer, getTransformMode());
},
get moduleCache() {
return state().moduleCache;
},
get mockMap() {
return state().mockMap;
},
get interopDefault() {
return state().config.deps.interopDefault;
},
get moduleDirectories() {
return state().config.deps.moduleDirectories;
},
get root() {
return state().config.root;
},
get base() {
return state().config.base;
},
...options
});
}
function updateStyle(id, css) {
if (typeof document === "undefined")
return;
const element = document.querySelector(`[data-vite-dev-id="${id}"]`);
if (element) {
element.textContent = css;
return;
}
const head = document.querySelector("head");
const style = document.createElement("style");
style.setAttribute("type", "text/css");
style.setAttribute("data-vite-dev-id", id);
style.textContent = css;
head == null ? void 0 : head.appendChild(style);
}
function removeStyle(id) {
if (typeof document === "undefined")
return;
const sheet = document.querySelector(`[data-vite-dev-id="${id}"]`);
if (sheet)
document.head.removeChild(sheet);
}
function getDefaultRequestStubs(context) {
if (!context) {
const clientStub2 = { ...DEFAULT_REQUEST_STUBS["@vite/client"], updateStyle, removeStyle };
return {
"/@vite/client": clientStub2,
"@vite/client": clientStub2
};
}
const clientStub = vm.runInContext(
`(defaultClient) => ({ ...defaultClient, updateStyle: ${updateStyle.toString()}, removeStyle: ${removeStyle.toString()} })`,
context
)(DEFAULT_REQUEST_STUBS["@vite/client"]);
return {
"/@vite/client": clientStub,
"@vite/client": clientStub
};
}
class VitestExecutor extends ViteNodeRunner {
constructor(options) {
super({
...options,
// interop is done inside the external executor instead
interopDefault: options.context ? false : options.interopDefault
});
this.options = options;
this.mocker = new VitestMocker(this);
if (!options.context) {
Object.defineProperty(globalThis, "__vitest_mocker__", {
value: this.mocker,
writable: true,
configurable: true
});
this.primitives = { Object, Reflect, Symbol };
} else if (options.externalModulesExecutor) {
this.primitives = vm.runInContext("({ Object, Reflect, Symbol })", options.context);
this.externalModules = options.externalModulesExecutor;
} else {
throw new Error("When context is provided, externalModulesExecutor must be provided as well.");
}
}
mocker;
externalModules;
primitives;
getContextPrimitives() {
return this.primitives;
}
get state() {
return globalThis.__vitest_worker__ || this.options.state;
}
shouldResolveId(id, _importee) {
var _a;
if (isInternalRequest(id) || id.startsWith("data:"))
return false;
const transformMode = ((_a = this.state.environment) == null ? void 0 : _a.transformMode) ?? "ssr";
return transformMode === "ssr" ? !isNodeBuiltin(id) : !id.startsWith("node:");
}
async originalResolveUrl(id, importer) {
return super.resolveUrl(id, importer);
}
async resolveUrl(id, importer) {
if (VitestMocker.pendingIds.length)
await this.mocker.resolveMocks();
if (importer && importer.startsWith("mock:"))
importer = importer.slice(5);
try {
return await super.resolveUrl(id, importer);
} catch (error) {
if (error.code === "ERR_MODULE_NOT_FOUND") {
const { id: id2 } = error[Symbol.for("vitest.error.not_found.data")];
const path = this.mocker.normalizePath(id2);
const mock = this.mocker.getDependencyMock(path);
if (mock !== void 0)
return [id2, id2];
}
throw error;
}
}
async runModule(context, transformed) {
const vmContext = this.options.context;
if (!vmContext || !this.externalModules)
return super.runModule(context, transformed);
const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
const code = `${codeDefinition}${transformed}
}}`;
const options = {
filename: context.__filename,
lineOffset: 0,
columnOffset: -codeDefinition.length
};
const fn = vm.runInContext(code, vmContext, {
...options,
// if we encountered an import, it's not inlined
importModuleDynamically: this.externalModules.importModuleDynamically
});
await fn(...Object.values(context));
}
async importExternalModule(path) {
if (this.externalModules)
return this.externalModules.import(path);
return super.importExternalModule(path);
}
async dependencyRequest(id, fsPath, callstack) {
const mocked = await this.mocker.requestWithMock(fsPath, callstack);
if (typeof mocked === "string")
return super.dependencyRequest(mocked, mocked, callstack);
if (mocked && typeof mocked === "object")
return mocked;
return super.dependencyRequest(id, fsPath, callstack);
}
prepareContext(context) {
if (this.state.filepath && normalize(this.state.filepath) === normalize(context.__filename)) {
const globalNamespace = this.options.context || globalThis;
Object.defineProperty(context.__vite_ssr_import_meta__, "vitest", { get: () => globalNamespace.__vitest_index__ });
}
if (this.options.context && this.externalModules)
context.require = this.externalModules.createRequire(context.__filename);
return context;
}
}
export { VitestExecutor as V, getDefaultRequestStubs as g, startVitestExecutor as s };

View File

@@ -0,0 +1,23 @@
function getWorkerState() {
const workerState = globalThis.__vitest_worker__;
if (!workerState) {
const errorMsg = 'Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
throw new Error(errorMsg);
}
return workerState;
}
function provideWorkerState(context, state) {
Object.defineProperty(context, "__vitest_worker__", {
value: state,
configurable: true,
writable: true,
enumerable: false
});
return state;
}
function getCurrentEnvironment() {
const state = getWorkerState();
return state == null ? void 0 : state.environment.name;
}
export { getCurrentEnvironment as a, getWorkerState as g, provideWorkerState as p };

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,99 @@
const DEFAULT_TIMEOUT = 6e4;
function defaultSerialize(i) {
return i;
}
const defaultDeserialize = defaultSerialize;
const { clearTimeout, setTimeout } = globalThis;
const random = Math.random.bind(Math);
function createBirpc(functions, options) {
const {
post,
on,
eventNames = [],
serialize = defaultSerialize,
deserialize = defaultDeserialize,
resolver,
timeout = DEFAULT_TIMEOUT
} = options;
const rpcPromiseMap = /* @__PURE__ */ new Map();
let _promise;
const rpc = new Proxy({}, {
get(_, method) {
if (method === "$functions")
return functions;
const sendEvent = (...args) => {
post(serialize({ m: method, a: args, t: "q" }));
};
if (eventNames.includes(method)) {
sendEvent.asEvent = sendEvent;
return sendEvent;
}
const sendCall = async (...args) => {
await _promise;
return new Promise((resolve, reject) => {
const id = nanoid();
let timeoutId;
if (timeout >= 0) {
timeoutId = setTimeout(() => {
try {
options.onTimeoutError?.(method, args);
throw new Error(`[birpc] timeout on calling "${method}"`);
} catch (e) {
reject(e);
}
rpcPromiseMap.delete(id);
}, timeout).unref?.();
}
rpcPromiseMap.set(id, { resolve, reject, timeoutId });
post(serialize({ m: method, a: args, i: id, t: "q" }));
});
};
sendCall.asEvent = sendEvent;
return sendCall;
}
});
_promise = on(async (data, ...extra) => {
const msg = deserialize(data);
if (msg.t === "q") {
const { m: method, a: args } = msg;
let result, error;
const fn = resolver ? resolver(method, functions[method]) : functions[method];
if (!fn) {
error = new Error(`[birpc] function "${method}" not found`);
} else {
try {
result = await fn.apply(rpc, args);
} catch (e) {
error = e;
}
}
if (msg.i) {
if (error && options.onError)
options.onError(error, method, args);
post(serialize({ t: "s", i: msg.i, r: result, e: error }), ...extra);
}
} else {
const { i: ack, r: result, e: error } = msg;
const promise = rpcPromiseMap.get(ack);
if (promise) {
clearTimeout(promise.timeoutId);
if (error)
promise.reject(error);
else
promise.resolve(result);
}
rpcPromiseMap.delete(ack);
}
});
return rpc;
}
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
function nanoid(size = 21) {
let id = "";
let i = size;
while (i--)
id += urlAlphabet[random() * 64 | 0];
return id;
}
export { createBirpc as c };

View File

@@ -0,0 +1,99 @@
import * as chai from 'chai';
import { resolve } from 'pathe';
import { distDir } from '../path.js';
import { g as getWorkerState } from './global.CkGT_TMy.js';
import { r as rpc } from './rpc.joBhAkyK.js';
import { t as takeCoverageInsideWorker } from './coverage.E7sG1b3r.js';
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.8nJLd4ay.js';
function setupChaiConfig(config) {
Object.assign(chai.config, config);
}
async function resolveSnapshotEnvironment(config, executor) {
if (!config.snapshotEnvironment) {
const { VitestNodeSnapshotEnvironment } = await import('../chunks/environments-node.vcoXCoKs.js');
return new VitestNodeSnapshotEnvironment();
}
const mod = await executor.executeId(config.snapshotEnvironment);
if (typeof mod.default !== "object" || !mod.default)
throw new Error("Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`");
return mod.default;
}
const runnersFile = resolve(distDir, "runners.js");
async function getTestRunnerConstructor(config, executor) {
if (!config.runner) {
const { VitestTestRunner, NodeBenchmarkRunner } = await executor.executeFile(runnersFile);
return config.mode === "test" ? VitestTestRunner : NodeBenchmarkRunner;
}
const mod = await executor.executeId(config.runner);
if (!mod.default && typeof mod.default !== "function")
throw new Error(`Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`);
return mod.default;
}
async function resolveTestRunner(config, executor) {
const TestRunner = await getTestRunnerConstructor(config, executor);
const testRunner = new TestRunner(config);
Object.defineProperty(testRunner, "__vitest_executor", {
value: executor,
enumerable: false,
configurable: false
});
if (!testRunner.config)
testRunner.config = config;
if (!testRunner.importFile)
throw new Error('Runner must implement "importFile" method.');
const [diffOptions] = await Promise.all([
loadDiffConfig(config, executor),
loadSnapshotSerializers(config, executor)
]);
testRunner.config.diffOptions = diffOptions;
const originalOnTaskUpdate = testRunner.onTaskUpdate;
testRunner.onTaskUpdate = async (task) => {
const p = rpc().onTaskUpdate(task);
await (originalOnTaskUpdate == null ? void 0 : originalOnTaskUpdate.call(testRunner, task));
return p;
};
const originalOnCollected = testRunner.onCollected;
testRunner.onCollected = async (files) => {
const state = getWorkerState();
files.forEach((file) => {
file.prepareDuration = state.durations.prepare;
file.environmentLoad = state.durations.environment;
state.durations.prepare = 0;
state.durations.environment = 0;
});
rpc().onCollected(files);
await (originalOnCollected == null ? void 0 : originalOnCollected.call(testRunner, files));
};
const originalOnAfterRun = testRunner.onAfterRunFiles;
testRunner.onAfterRunFiles = async (files) => {
const state = getWorkerState();
const coverage = await takeCoverageInsideWorker(config.coverage, executor);
if (coverage) {
rpc().onAfterSuiteRun({
coverage,
transformMode: state.environment.transformMode,
projectName: state.ctx.projectName
});
}
await (originalOnAfterRun == null ? void 0 : originalOnAfterRun.call(testRunner, files));
};
const originalOnAfterRunTask = testRunner.onAfterRunTask;
testRunner.onAfterRunTask = async (test) => {
var _a, _b;
if (config.bail && ((_a = test.result) == null ? void 0 : _a.state) === "fail") {
const previousFailures = await rpc().getCountOfFailedTests();
const currentFailures = 1 + previousFailures;
if (currentFailures >= config.bail) {
rpc().onCancel("test-failure");
(_b = testRunner.onCancel) == null ? void 0 : _b.call(testRunner, "test-failure");
}
}
await (originalOnAfterRunTask == null ? void 0 : originalOnAfterRunTask.call(testRunner, test));
};
return testRunner;
}
export { resolveSnapshotEnvironment as a, resolveTestRunner as r, setupChaiConfig as s };

View File

@@ -0,0 +1,678 @@
import { Console } from 'node:console';
const denyList = /* @__PURE__ */ new Set([
"GLOBAL",
"root",
"global",
"Buffer",
"ArrayBuffer",
"Uint8Array"
]);
const nodeGlobals = new Map(
Object.getOwnPropertyNames(globalThis).filter((global) => !denyList.has(global)).map((nodeGlobalsKey) => {
const descriptor = Object.getOwnPropertyDescriptor(
globalThis,
nodeGlobalsKey
);
if (!descriptor) {
throw new Error(
`No property descriptor for ${nodeGlobalsKey}, this is a bug in Vitest.`
);
}
return [nodeGlobalsKey, descriptor];
})
);
var node = {
name: "node",
transformMode: "ssr",
// this is largely copied from jest's node environment
async setupVM() {
const vm = await import('node:vm');
let context = vm.createContext();
let global = vm.runInContext(
"this",
context
);
const contextGlobals = new Set(Object.getOwnPropertyNames(global));
for (const [nodeGlobalsKey, descriptor] of nodeGlobals) {
if (!contextGlobals.has(nodeGlobalsKey)) {
if (descriptor.configurable) {
Object.defineProperty(global, nodeGlobalsKey, {
configurable: true,
enumerable: descriptor.enumerable,
get() {
const val = globalThis[nodeGlobalsKey];
Object.defineProperty(global, nodeGlobalsKey, {
configurable: true,
enumerable: descriptor.enumerable,
value: val,
writable: descriptor.writable === true || nodeGlobalsKey === "performance"
});
return val;
},
set(val) {
Object.defineProperty(global, nodeGlobalsKey, {
configurable: true,
enumerable: descriptor.enumerable,
value: val,
writable: true
});
}
});
} else if ("value" in descriptor) {
Object.defineProperty(global, nodeGlobalsKey, {
configurable: false,
enumerable: descriptor.enumerable,
value: descriptor.value,
writable: descriptor.writable
});
} else {
Object.defineProperty(global, nodeGlobalsKey, {
configurable: false,
enumerable: descriptor.enumerable,
get: descriptor.get,
set: descriptor.set
});
}
}
}
global.global = global;
global.Buffer = Buffer;
global.ArrayBuffer = ArrayBuffer;
global.Uint8Array = Uint8Array;
return {
getVmContext() {
return context;
},
teardown() {
context = void 0;
global = void 0;
}
};
},
async setup(global) {
global.console.Console = Console;
return {
teardown(global2) {
delete global2.console.Console;
}
};
}
};
const LIVING_KEYS = [
"DOMException",
"URL",
"URLSearchParams",
"EventTarget",
"NamedNodeMap",
"Node",
"Attr",
"Element",
"DocumentFragment",
"DOMImplementation",
"Document",
"XMLDocument",
"CharacterData",
"Text",
"CDATASection",
"ProcessingInstruction",
"Comment",
"DocumentType",
"NodeList",
"RadioNodeList",
"HTMLCollection",
"HTMLOptionsCollection",
"DOMStringMap",
"DOMTokenList",
"StyleSheetList",
"HTMLElement",
"HTMLHeadElement",
"HTMLTitleElement",
"HTMLBaseElement",
"HTMLLinkElement",
"HTMLMetaElement",
"HTMLStyleElement",
"HTMLBodyElement",
"HTMLHeadingElement",
"HTMLParagraphElement",
"HTMLHRElement",
"HTMLPreElement",
"HTMLUListElement",
"HTMLOListElement",
"HTMLLIElement",
"HTMLMenuElement",
"HTMLDListElement",
"HTMLDivElement",
"HTMLAnchorElement",
"HTMLAreaElement",
"HTMLBRElement",
"HTMLButtonElement",
"HTMLCanvasElement",
"HTMLDataElement",
"HTMLDataListElement",
"HTMLDetailsElement",
"HTMLDialogElement",
"HTMLDirectoryElement",
"HTMLFieldSetElement",
"HTMLFontElement",
"HTMLFormElement",
"HTMLHtmlElement",
"HTMLImageElement",
"HTMLInputElement",
"HTMLLabelElement",
"HTMLLegendElement",
"HTMLMapElement",
"HTMLMarqueeElement",
"HTMLMediaElement",
"HTMLMeterElement",
"HTMLModElement",
"HTMLOptGroupElement",
"HTMLOptionElement",
"HTMLOutputElement",
"HTMLPictureElement",
"HTMLProgressElement",
"HTMLQuoteElement",
"HTMLScriptElement",
"HTMLSelectElement",
"HTMLSlotElement",
"HTMLSourceElement",
"HTMLSpanElement",
"HTMLTableCaptionElement",
"HTMLTableCellElement",
"HTMLTableColElement",
"HTMLTableElement",
"HTMLTimeElement",
"HTMLTableRowElement",
"HTMLTableSectionElement",
"HTMLTemplateElement",
"HTMLTextAreaElement",
"HTMLUnknownElement",
"HTMLFrameElement",
"HTMLFrameSetElement",
"HTMLIFrameElement",
"HTMLEmbedElement",
"HTMLObjectElement",
"HTMLParamElement",
"HTMLVideoElement",
"HTMLAudioElement",
"HTMLTrackElement",
"HTMLFormControlsCollection",
"SVGElement",
"SVGGraphicsElement",
"SVGSVGElement",
"SVGTitleElement",
"SVGAnimatedString",
"SVGNumber",
"SVGStringList",
"Event",
"CloseEvent",
"CustomEvent",
"MessageEvent",
"ErrorEvent",
"HashChangeEvent",
"PopStateEvent",
"StorageEvent",
"ProgressEvent",
"PageTransitionEvent",
"SubmitEvent",
"UIEvent",
"FocusEvent",
"InputEvent",
"MouseEvent",
"KeyboardEvent",
"TouchEvent",
"CompositionEvent",
"WheelEvent",
"BarProp",
"External",
"Location",
"History",
"Screen",
"Crypto",
"Performance",
"Navigator",
"PluginArray",
"MimeTypeArray",
"Plugin",
"MimeType",
"FileReader",
"Blob",
"File",
"FileList",
"ValidityState",
"DOMParser",
"XMLSerializer",
"FormData",
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload",
"XMLHttpRequest",
"WebSocket",
"NodeFilter",
"NodeIterator",
"TreeWalker",
"AbstractRange",
"Range",
"StaticRange",
"Selection",
"Storage",
"CustomElementRegistry",
"ShadowRoot",
"MutationObserver",
"MutationRecord",
"Headers",
"AbortController",
"AbortSignal",
"Uint8Array",
"Uint16Array",
"Uint32Array",
"Uint8ClampedArray",
"Int8Array",
"Int16Array",
"Int32Array",
"Float32Array",
"Float64Array",
"ArrayBuffer",
"DOMRectReadOnly",
"DOMRect",
// not specified in docs, but is available
"Image",
"Audio",
"Option",
"CSS"
];
const OTHER_KEYS = [
"addEventListener",
"alert",
// 'atob',
"blur",
// 'btoa',
"cancelAnimationFrame",
/* 'clearInterval', */
/* 'clearTimeout', */
"close",
"confirm",
/* 'console', */
"createPopup",
"dispatchEvent",
"document",
"focus",
"frames",
"getComputedStyle",
"history",
"innerHeight",
"innerWidth",
"length",
"location",
"matchMedia",
"moveBy",
"moveTo",
"name",
"navigator",
"open",
"outerHeight",
"outerWidth",
"pageXOffset",
"pageYOffset",
"parent",
"postMessage",
"print",
"prompt",
"removeEventListener",
"requestAnimationFrame",
"resizeBy",
"resizeTo",
"screen",
"screenLeft",
"screenTop",
"screenX",
"screenY",
"scroll",
"scrollBy",
"scrollLeft",
"scrollTo",
"scrollTop",
"scrollX",
"scrollY",
"self",
/* 'setInterval', */
/* 'setTimeout', */
"stop",
/* 'toString', */
"top",
"Window",
"window"
];
const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
const skipKeys = [
"window",
"self",
"top",
"parent"
];
function getWindowKeys(global, win, additionalKeys = []) {
const keysArray = [...additionalKeys, ...KEYS];
const keys = new Set(keysArray.concat(Object.getOwnPropertyNames(win)).filter((k) => {
if (skipKeys.includes(k))
return false;
if (k in global)
return keysArray.includes(k);
return true;
}));
return keys;
}
function isClassLikeName(name) {
return name[0] === name[0].toUpperCase();
}
function populateGlobal(global, win, options = {}) {
const { bindFunctions = false } = options;
const keys = getWindowKeys(global, win, options.additionalKeys);
const originals = /* @__PURE__ */ new Map();
const overrideObject = /* @__PURE__ */ new Map();
for (const key of keys) {
const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
if (KEYS.includes(key) && key in global)
originals.set(key, global[key]);
Object.defineProperty(global, key, {
get() {
if (overrideObject.has(key))
return overrideObject.get(key);
if (boundFunction)
return boundFunction;
return win[key];
},
set(v) {
overrideObject.set(key, v);
},
configurable: true
});
}
global.window = global;
global.self = global;
global.top = global;
global.parent = global;
if (global.global)
global.global = global;
if (global.document && global.document.defaultView) {
Object.defineProperty(global.document, "defaultView", {
get: () => global,
enumerable: true,
configurable: true
});
}
skipKeys.forEach((k) => keys.add(k));
return {
keys,
skipKeys,
originals
};
}
function catchWindowErrors(window) {
let userErrorListenerCount = 0;
function throwUnhandlerError(e) {
if (userErrorListenerCount === 0 && e.error != null)
process.emit("uncaughtException", e.error);
}
const addEventListener = window.addEventListener.bind(window);
const removeEventListener = window.removeEventListener.bind(window);
window.addEventListener("error", throwUnhandlerError);
window.addEventListener = function(...args) {
if (args[0] === "error")
userErrorListenerCount++;
return addEventListener.apply(this, args);
};
window.removeEventListener = function(...args) {
if (args[0] === "error" && userErrorListenerCount)
userErrorListenerCount--;
return removeEventListener.apply(this, args);
};
return function clearErrorHandlers() {
window.removeEventListener("error", throwUnhandlerError);
};
}
var jsdom = {
name: "jsdom",
transformMode: "web",
async setupVM({ jsdom = {} }) {
const {
CookieJar,
JSDOM,
ResourceLoader,
VirtualConsole
} = await import('jsdom');
const {
html = "<!DOCTYPE html>",
userAgent,
url = "http://localhost:3000",
contentType = "text/html",
pretendToBeVisual = true,
includeNodeLocations = false,
runScripts = "dangerously",
resources,
console = false,
cookieJar = false,
...restOptions
} = jsdom;
let dom = new JSDOM(
html,
{
pretendToBeVisual,
resources: resources ?? (userAgent ? new ResourceLoader({ userAgent }) : void 0),
runScripts,
url,
virtualConsole: console && globalThis.console ? new VirtualConsole().sendTo(globalThis.console) : void 0,
cookieJar: cookieJar ? new CookieJar() : void 0,
includeNodeLocations,
contentType,
userAgent,
...restOptions
}
);
const clearWindowErrors = catchWindowErrors(dom.window);
dom.window.Buffer = Buffer;
dom.window.jsdom = dom;
const globalNames = [
"structuredClone",
"fetch",
"Request",
"Response",
"BroadcastChannel",
"MessageChannel",
"MessagePort",
"TextEncoder",
"TextDecoder"
];
for (const name of globalNames) {
const value = globalThis[name];
if (typeof value !== "undefined" && typeof dom.window[name] === "undefined")
dom.window[name] = value;
}
return {
getVmContext() {
return dom.getInternalVMContext();
},
teardown() {
clearWindowErrors();
dom.window.close();
dom = void 0;
}
};
},
async setup(global, { jsdom = {} }) {
const {
CookieJar,
JSDOM,
ResourceLoader,
VirtualConsole
} = await import('jsdom');
const {
html = "<!DOCTYPE html>",
userAgent,
url = "http://localhost:3000",
contentType = "text/html",
pretendToBeVisual = true,
includeNodeLocations = false,
runScripts = "dangerously",
resources,
console = false,
cookieJar = false,
...restOptions
} = jsdom;
const dom = new JSDOM(
html,
{
pretendToBeVisual,
resources: resources ?? (userAgent ? new ResourceLoader({ userAgent }) : void 0),
runScripts,
url,
virtualConsole: console && global.console ? new VirtualConsole().sendTo(global.console) : void 0,
cookieJar: cookieJar ? new CookieJar() : void 0,
includeNodeLocations,
contentType,
userAgent,
...restOptions
}
);
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
const clearWindowErrors = catchWindowErrors(global);
global.jsdom = dom;
return {
teardown(global2) {
clearWindowErrors();
dom.window.close();
delete global2.jsdom;
keys.forEach((key) => delete global2[key]);
originals.forEach((v, k) => global2[k] = v);
}
};
}
};
async function teardownWindow(win) {
if (win.close && win.happyDOM.abort) {
await win.happyDOM.abort();
win.close();
} else {
win.happyDOM.cancelAsync();
}
}
var happy = {
name: "happy-dom",
transformMode: "web",
async setupVM({ happyDOM = {} }) {
const { Window } = await import('happy-dom');
let win = new Window({
...happyDOM,
console: console && globalThis.console ? globalThis.console : void 0,
url: happyDOM.url || "http://localhost:3000",
settings: {
...happyDOM.settings,
disableErrorCapturing: true
}
});
win.Buffer = Buffer;
if (typeof structuredClone !== "undefined" && !win.structuredClone)
win.structuredClone = structuredClone;
return {
getVmContext() {
return win;
},
async teardown() {
await teardownWindow(win);
win = void 0;
}
};
},
async setup(global, { happyDOM = {} }) {
const { Window, GlobalWindow } = await import('happy-dom');
const win = new (GlobalWindow || Window)({
...happyDOM,
console: console && global.console ? global.console : void 0,
url: happyDOM.url || "http://localhost:3000",
settings: {
...happyDOM.settings,
disableErrorCapturing: true
}
});
const { keys, originals } = populateGlobal(global, win, {
bindFunctions: true,
// jsdom doesn't support Request and Response, but happy-dom does
additionalKeys: ["Request", "Response"]
});
return {
async teardown(global2) {
await teardownWindow(win);
keys.forEach((key) => delete global2[key]);
originals.forEach((v, k) => global2[k] = v);
}
};
}
};
var edge = {
name: "edge-runtime",
transformMode: "ssr",
async setupVM() {
const { EdgeVM } = await import('@edge-runtime/vm');
const vm = new EdgeVM({
extend: (context) => {
context.global = context;
context.Buffer = Buffer;
return context;
}
});
return {
getVmContext() {
return vm.context;
},
teardown() {
}
};
},
async setup(global) {
const { EdgeVM } = await import('@edge-runtime/vm');
const vm = new EdgeVM({
extend: (context) => {
context.global = context;
context.Buffer = Buffer;
KEYS.forEach((key) => {
if (key in global)
context[key] = global[key];
});
return context;
}
});
const { keys, originals } = populateGlobal(global, vm.context, { bindFunctions: true });
return {
teardown(global2) {
keys.forEach((key) => delete global2[key]);
originals.forEach((v, k) => global2[k] = v);
}
};
}
};
const environments = {
node,
jsdom,
"happy-dom": happy,
"edge-runtime": edge
};
const envPackageNames = {
"jsdom": "jsdom",
"happy-dom": "happy-dom",
"edge-runtime": "@edge-runtime/vm"
};
function getEnvPackageName(env) {
if (env === "node")
return null;
if (env in envPackageNames)
return envPackageNames[env];
if (env[0] === "." || env[0] === "/")
return null;
return `vitest-environment-${env}`;
}
export { environments as e, getEnvPackageName as g, populateGlobal as p };

View File

@@ -0,0 +1,22 @@
import { relative } from 'pathe';
import '@vitest/runner/utils';
import '@vitest/utils';
import { g as getWorkerState } from './global.CkGT_TMy.js';
import './env.AtSIuHFg.js';
function getRunMode() {
return getWorkerState().config.mode;
}
function isRunningInBenchmark() {
return getRunMode() === "benchmark";
}
const relativePath = relative;
function removeUndefinedValues(obj) {
for (const key in Object.keys(obj)) {
if (obj[key] === void 0)
delete obj[key];
}
return obj;
}
export { removeUndefinedValues as a, isRunningInBenchmark as i, relativePath as r };

View File

@@ -0,0 +1,129 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
import { b as bench } from './benchmark.yGkUTKnC.js';
import { i as isFirstRun, a as runOnce } from './run-once.Olz_Zkd8.js';
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.YFlodzP_.js';
import { g as getWorkerState } from './global.CkGT_TMy.js';
import * as chai from 'chai';
import { assert, should } from 'chai';
function getRunningMode() {
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
}
function isWatchMode() {
return getRunningMode() === "watch";
}
function inject(key) {
const workerState = getWorkerState();
return workerState.providedContext[key];
}
var dist = {};
(function (exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.expectTypeOf = void 0;
const fn = () => true;
/**
* Similar to Jest's `expect`, but with type-awareness.
* Gives you access to a number of type-matchers that let you make assertions about the
* form of a reference or generic type parameter.
*
* @example
* import {foo, bar} from '../foo'
* import {expectTypeOf} from 'expect-type'
*
* test('foo types', () => {
* // make sure `foo` has type {a: number}
* expectTypeOf(foo).toMatchTypeOf({a: 1})
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
*
* // make sure `bar` is a function taking a string:
* expectTypeOf(bar).parameter(0).toBeString()
* expectTypeOf(bar).returns.not.toBeAny()
* })
*
* @description
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
*/
const expectTypeOf = (_actual) => {
const nonFunctionProperties = [
'parameters',
'returns',
'resolves',
'not',
'items',
'constructorParameters',
'thisParameter',
'instance',
'guards',
'asserts',
'branded',
];
const obj = {
/* eslint-disable mmkal/@typescript-eslint/no-unsafe-assignment */
toBeAny: fn,
toBeUnknown: fn,
toBeNever: fn,
toBeFunction: fn,
toBeObject: fn,
toBeArray: fn,
toBeString: fn,
toBeNumber: fn,
toBeBoolean: fn,
toBeVoid: fn,
toBeSymbol: fn,
toBeNull: fn,
toBeUndefined: fn,
toBeNullable: fn,
toMatchTypeOf: fn,
toEqualTypeOf: fn,
toBeCallableWith: fn,
toBeConstructibleWith: fn,
/* eslint-enable mmkal/@typescript-eslint/no-unsafe-assignment */
extract: exports.expectTypeOf,
exclude: exports.expectTypeOf,
toHaveProperty: exports.expectTypeOf,
parameter: exports.expectTypeOf,
};
const getterProperties = nonFunctionProperties;
getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
return obj;
};
exports.expectTypeOf = expectTypeOf;
} (dist));
function noop() {
}
const assertType = noop;
var VitestIndex = /*#__PURE__*/Object.freeze({
__proto__: null,
afterAll: afterAll,
afterEach: afterEach,
assert: assert,
assertType: assertType,
beforeAll: beforeAll,
beforeEach: beforeEach,
bench: bench,
chai: chai,
createExpect: createExpect,
describe: describe,
expect: globalExpect,
expectTypeOf: dist.expectTypeOf,
getRunningMode: getRunningMode,
inject: inject,
isFirstRun: isFirstRun,
isWatchMode: isWatchMode,
it: it,
onTestFailed: onTestFailed,
onTestFinished: onTestFinished,
runOnce: runOnce,
should: should,
suite: suite,
test: test,
vi: vi,
vitest: vitest
});
export { VitestIndex as V, isWatchMode as a, assertType as b, dist as d, getRunningMode as g, inject as i };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
import { createRequire } from 'node:module';
const __require = createRequire(import.meta.url);
let inspector;
let session;
function setupInspect(ctx) {
const config = ctx.config;
const isEnabled = config.inspector.enabled;
if (isEnabled) {
inspector = __require("node:inspector");
const isOpen = inspector.url() !== void 0;
if (!isOpen) {
inspector.open(
config.inspector.port,
config.inspector.host,
config.inspector.waitForDebugger
);
if (config.inspectBrk) {
const firstTestFile = ctx.files[0];
if (firstTestFile) {
session = new inspector.Session();
session.connect();
session.post("Debugger.enable");
session.post("Debugger.setBreakpointByUrl", {
lineNumber: 0,
url: new URL(firstTestFile, import.meta.url).href
});
}
}
}
}
const keepOpen = shouldKeepOpen(config);
return function cleanup() {
if (isEnabled && !keepOpen && inspector) {
inspector.close();
session == null ? void 0 : session.disconnect();
}
};
}
function closeInspector(config) {
const keepOpen = shouldKeepOpen(config);
if (inspector && !keepOpen) {
inspector.close();
session == null ? void 0 : session.disconnect();
}
}
function shouldKeepOpen(config) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const isIsolatedSingleThread = config.pool === "threads" && ((_b = (_a = config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.isolate) === false && ((_d = (_c = config.poolOptions) == null ? void 0 : _c.threads) == null ? void 0 : _d.singleThread);
const isIsolatedSingleFork = config.pool === "forks" && ((_f = (_e = config.poolOptions) == null ? void 0 : _e.forks) == null ? void 0 : _f.isolate) === false && ((_h = (_g = config.poolOptions) == null ? void 0 : _g.forks) == null ? void 0 : _h.singleFork);
return config.watch && (isIsolatedSingleFork || isIsolatedSingleThread);
}
export { closeInspector as c, setupInspect as s };

View File

@@ -0,0 +1,94 @@
import { getSafeTimers } from '@vitest/utils';
import { c as createBirpc } from './index.8bPxjt7g.js';
import { g as getWorkerState } from './global.CkGT_TMy.js';
const { get } = Reflect;
function withSafeTimers(fn) {
var _a;
const { setTimeout, clearTimeout, nextTick, setImmediate, clearImmediate } = getSafeTimers();
const currentSetTimeout = globalThis.setTimeout;
const currentClearTimeout = globalThis.clearTimeout;
const currentSetImmediate = globalThis.setImmediate;
const currentClearImmediate = globalThis.clearImmediate;
const currentNextTick = (_a = globalThis.process) == null ? void 0 : _a.nextTick;
try {
globalThis.setTimeout = setTimeout;
globalThis.clearTimeout = clearTimeout;
globalThis.setImmediate = setImmediate;
globalThis.clearImmediate = clearImmediate;
if (globalThis.process)
globalThis.process.nextTick = nextTick;
const result = fn();
return result;
} finally {
globalThis.setTimeout = currentSetTimeout;
globalThis.clearTimeout = currentClearTimeout;
globalThis.setImmediate = currentSetImmediate;
globalThis.clearImmediate = currentClearImmediate;
if (globalThis.process) {
nextTick(() => {
globalThis.process.nextTick = currentNextTick;
});
}
}
}
const promises = /* @__PURE__ */ new Set();
async function rpcDone() {
if (!promises.size)
return;
const awaitable = Array.from(promises);
return Promise.all(awaitable);
}
function createRuntimeRpc(options) {
let setCancel = (_reason) => {
};
const onCancel = new Promise((resolve) => {
setCancel = resolve;
});
const rpc2 = createSafeRpc(createBirpc(
{
onCancel: setCancel
},
{
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
onTimeoutError(functionName, args) {
var _a;
let message = `[vitest-worker]: Timeout calling "${functionName}"`;
if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId")
message += ` with "${JSON.stringify(args)}"`;
if (functionName === "onUnhandledError")
message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
throw new Error(message);
},
...options
}
));
return {
rpc: rpc2,
onCancel
};
}
function createSafeRpc(rpc2) {
return new Proxy(rpc2, {
get(target, p, handler) {
const sendCall = get(target, p, handler);
const safeSendCall = (...args) => withSafeTimers(async () => {
const result = sendCall(...args);
promises.add(result);
try {
return await result;
} finally {
promises.delete(result);
}
});
safeSendCall.asEvent = sendCall.asEvent;
return safeSendCall;
}
});
}
function rpc() {
const { rpc: rpc2 } = getWorkerState();
return rpc2;
}
export { rpcDone as a, createRuntimeRpc as c, rpc as r };

View File

@@ -0,0 +1,27 @@
import { g as getWorkerState } from './global.CkGT_TMy.js';
const filesCount = /* @__PURE__ */ new Map();
const cache = /* @__PURE__ */ new Map();
function runOnce(fn, key) {
const filepath = getWorkerState().filepath || "__unknown_files__";
if (!key) {
filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
key = String(filesCount.get(filepath));
}
const id = `${filepath}:${key}`;
if (!cache.has(id))
cache.set(id, fn());
return cache.get(id);
}
function isFirstRun() {
let firstRun = false;
runOnce(() => {
firstRun = true;
}, "__vitest_first_run__");
return firstRun;
}
function resetRunOnceCounter() {
filesCount.clear();
}
export { runOnce as a, isFirstRun as i, resetRunOnceCounter as r };

View File

@@ -0,0 +1,55 @@
import { setSafeTimers } from '@vitest/utils';
import { addSerializer } from '@vitest/snapshot';
import { r as resetRunOnceCounter } from './run-once.Olz_Zkd8.js';
let globalSetup = false;
async function setupCommonEnv(config) {
resetRunOnceCounter();
setupDefines(config.defines);
setupEnv(config.env);
if (globalSetup)
return;
globalSetup = true;
setSafeTimers();
if (config.globals)
(await import('../chunks/integrations-globals.kw4co3rx.js')).registerApiGlobally();
}
function setupDefines(defines) {
for (const key in defines)
globalThis[key] = defines[key];
}
function setupEnv(env) {
if (typeof process === "undefined")
return;
const { PROD, DEV, ...restEnvs } = env;
process.env.PROD = PROD ? "1" : "";
process.env.DEV = DEV ? "1" : "";
for (const key in restEnvs)
process.env[key] = env[key];
}
async function loadDiffConfig(config, executor) {
if (typeof config.diff !== "string")
return;
const diffModule = await executor.executeId(config.diff);
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null)
return diffModule.default;
else
throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
}
async function loadSnapshotSerializers(config, executor) {
const files = config.snapshotSerializers;
const snapshotSerializers = await Promise.all(
files.map(async (file) => {
const mo = await executor.executeId(file);
if (!mo || typeof mo.default !== "object" || mo.default === null)
throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
const config2 = mo.default;
if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function")
throw new Error(`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`);
return config2;
})
);
snapshotSerializers.forEach((serializer) => addSerializer(serializer));
}
export { loadSnapshotSerializers as a, loadDiffConfig as l, setupCommonEnv as s };

View File

@@ -0,0 +1,14 @@
import { getNames, getTests } from '@vitest/runner/utils';
import '@vitest/utils';
function hasFailedSnapshot(suite) {
return getTests(suite).some((s) => {
var _a, _b;
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/));
});
}
function getFullName(task, separator = " > ") {
return getNames(task).join(separator);
}
export { getFullName as g, hasFailedSnapshot as h };

View File

@@ -0,0 +1,49 @@
import { parseRegexp } from '@vitest/utils';
var _a, _b;
const REGEXP_WRAP_PREFIX = "$$vitest:";
const processSend = (_a = process.send) == null ? void 0 : _a.bind(process);
const processOn = (_b = process.on) == null ? void 0 : _b.bind(process);
function createThreadsRpcOptions({ port }) {
return {
post: (v) => {
port.postMessage(v);
},
on: (fn) => {
port.addListener("message", fn);
}
};
}
function createForksRpcOptions(nodeV8) {
return {
serialize: nodeV8.serialize,
deserialize: (v) => nodeV8.deserialize(Buffer.from(v)),
post(v) {
processSend(v);
},
on(fn) {
processOn("message", (message, ...extras) => {
if (message == null ? void 0 : message.__tinypool_worker_message__)
return;
return fn(message, ...extras);
});
}
};
}
function unwrapSerializableConfig(config) {
if (config.testNamePattern && typeof config.testNamePattern === "string") {
const testNamePattern = config.testNamePattern;
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX))
config.testNamePattern = parseRegexp(testNamePattern.slice(REGEXP_WRAP_PREFIX.length));
}
if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
const { keys, original } = config.defines;
const defines = {};
for (const key of keys)
defines[key] = original[key];
config.defines = defines;
}
return config;
}
export { createThreadsRpcOptions as a, createForksRpcOptions as c, unwrapSerializableConfig as u };

View File

@@ -0,0 +1,217 @@
import { isAbsolute, relative, dirname, basename } from 'pathe';
import c from 'picocolors';
import { a as slash } from './base.5NT-gWu5.js';
const F_RIGHT = "\u2192";
const F_DOWN = "\u2193";
const F_DOWN_RIGHT = "\u21B3";
const F_POINTER = "\u276F";
const F_DOT = "\xB7";
const F_CHECK = "\u2713";
const F_CROSS = "\xD7";
const F_LONG_DASH = "\u23AF";
function ansiRegex({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 ? undefined : 'g');
}
const regex = ansiRegex();
function stripAnsi(string) {
if (typeof string !== 'string') {
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
}
// Even though the regex is global, we don't need to reset the `.lastIndex`
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
// and doing it manually has a performance penalty.
return string.replace(regex, '');
}
const spinnerMap = /* @__PURE__ */ new WeakMap();
const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
const pointer = c.yellow(F_POINTER);
const skipped = c.dim(c.gray(F_DOWN));
function getCols(delta = 0) {
var _a;
let length = (_a = process.stdout) == null ? void 0 : _a.columns;
if (!length || Number.isNaN(length))
length = 30;
return Math.max(length + delta, 0);
}
function divider(text, left, right) {
const cols = getCols();
if (text) {
const textLength = stripAnsi(text).length;
if (left == null && right != null) {
left = cols - textLength - right;
} else {
left = left ?? Math.floor((cols - textLength) / 2);
right = cols - textLength - left;
}
left = Math.max(0, left);
right = Math.max(0, right);
return `${F_LONG_DASH.repeat(left)}${text}${F_LONG_DASH.repeat(right)}`;
}
return F_LONG_DASH.repeat(cols);
}
function formatTestPath(root, path) {
var _a;
if (isAbsolute(path))
path = relative(root, path);
const dir = dirname(path);
const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
const base = basename(path, ext);
return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
}
function renderSnapshotSummary(rootDir, snapshots) {
const summary = [];
if (snapshots.added)
summary.push(c.bold(c.green(`${snapshots.added} written`)));
if (snapshots.unmatched)
summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
if (snapshots.updated)
summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
if (snapshots.filesRemoved) {
if (snapshots.didUpdate)
summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
else
summary.push(c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `)));
}
if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
const [head, ...tail] = snapshots.filesRemovedList;
summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, head)}`);
tail.forEach((key) => {
summary.push(` ${c.gray(F_DOT)} ${formatTestPath(rootDir, key)}`);
});
}
if (snapshots.unchecked) {
if (snapshots.didUpdate)
summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
else
summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
summary.push(`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(rootDir, uncheckedFile.filePath)}`);
uncheckedFile.keys.forEach((key) => summary.push(` ${c.gray(F_DOT)} ${key}`));
});
}
return summary;
}
function countTestErrors(tasks) {
return tasks.reduce((c2, i) => {
var _a, _b;
return c2 + (((_b = (_a = i.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.length) || 0);
}, 0);
}
function getStateString(tasks, name = "tests", showTotal = true) {
if (tasks.length === 0)
return c.dim(`no ${name}`);
const passed = tasks.filter((i) => {
var _a;
return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
});
const failed = tasks.filter((i) => {
var _a;
return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
});
const skipped2 = tasks.filter((i) => i.mode === "skip");
const todo = tasks.filter((i) => i.mode === "todo");
return [
failed.length ? c.bold(c.red(`${failed.length} failed`)) : null,
passed.length ? c.bold(c.green(`${passed.length} passed`)) : null,
skipped2.length ? c.yellow(`${skipped2.length} skipped`) : null,
todo.length ? c.gray(`${todo.length} todo`) : null
].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
}
function getStateSymbol(task) {
var _a;
if (task.mode === "skip" || task.mode === "todo")
return skipped;
if (!task.result)
return c.gray("\xB7");
if (task.result.state === "run") {
if (task.type === "suite")
return pointer;
let spinner = spinnerMap.get(task);
if (!spinner) {
spinner = elegantSpinner();
spinnerMap.set(task, spinner);
}
return c.yellow(spinner());
}
if (task.result.state === "pass") {
return ((_a = task.meta) == null ? void 0 : _a.benchmark) ? c.green(F_DOT) : c.green(F_CHECK);
}
if (task.result.state === "fail") {
return task.type === "suite" ? pointer : c.red(F_CROSS);
}
return " ";
}
function getHookStateSymbol(task, hookName) {
var _a, _b;
const state = (_b = (_a = task.result) == null ? void 0 : _a.hooks) == null ? void 0 : _b[hookName];
if (state && state === "run") {
let spinnerMap2 = hookSpinnerMap.get(task);
if (!spinnerMap2) {
spinnerMap2 = /* @__PURE__ */ new Map();
hookSpinnerMap.set(task, spinnerMap2);
}
let spinner = spinnerMap2.get(hookName);
if (!spinner) {
spinner = elegantSpinner();
spinnerMap2.set(hookName, spinner);
}
return c.yellow(spinner());
}
}
const spinnerFrames = process.platform === "win32" ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
function elegantSpinner() {
let index = 0;
return () => {
index = ++index % spinnerFrames.length;
return spinnerFrames[index];
};
}
function formatTimeString(date) {
return date.toTimeString().split(" ")[0];
}
function formatProjectName(name, suffix = " ") {
if (!name)
return "";
const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
const colors = [
c.blue,
c.yellow,
c.cyan,
c.green,
c.magenta
];
return colors[index % colors.length](`|${name}|`) + suffix;
}
var utils = /*#__PURE__*/Object.freeze({
__proto__: null,
countTestErrors: countTestErrors,
divider: divider,
elegantSpinner: elegantSpinner,
formatProjectName: formatProjectName,
formatTestPath: formatTestPath,
formatTimeString: formatTimeString,
getCols: getCols,
getHookStateSymbol: getHookStateSymbol,
getStateString: getStateString,
getStateSymbol: getStateSymbol,
hookSpinnerMap: hookSpinnerMap,
pointer: pointer,
renderSnapshotSummary: renderSnapshotSummary,
skipped: skipped,
spinnerFrames: spinnerFrames,
spinnerMap: spinnerMap
});
export { F_RIGHT as F, getStateString as a, formatTimeString as b, countTestErrors as c, divider as d, getCols as e, formatProjectName as f, getStateSymbol as g, getHookStateSymbol as h, F_POINTER as i, pointer as p, renderSnapshotSummary as r, stripAnsi as s, utils as u };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,815 @@
import vm, { isContext } from 'node:vm';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
import { createCustomConsole } from '../chunks/runtime-console.EO5ha7qv.js';
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.fL3szUAI.js';
import { distDir } from '../path.js';
import { dirname as dirname$1 } from 'node:path';
import { statSync, existsSync, readFileSync } from 'node:fs';
import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData } from 'vite-node/utils';
import { createRequire, Module } from 'node:module';
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants';
import '@vitest/runner/utils';
import '@vitest/utils';
import { p as provideWorkerState } from './global.CkGT_TMy.js';
import './env.AtSIuHFg.js';
const _require = createRequire(import.meta.url);
const requiresCache = /* @__PURE__ */ new WeakMap();
class CommonjsExecutor {
context;
requireCache = /* @__PURE__ */ new Map();
publicRequireCache = this.createProxyCache();
moduleCache = /* @__PURE__ */ new Map();
builtinCache = /* @__PURE__ */ Object.create(null);
extensions = /* @__PURE__ */ Object.create(null);
fs;
Module;
constructor(options) {
this.context = options.context;
this.fs = options.fileMap;
const primitives = vm.runInContext("({ Object, Array, Error })", this.context);
const executor = this;
this.Module = class Module$1 {
exports;
isPreloading = false;
id;
filename;
loaded;
parent;
children = [];
path;
paths = [];
constructor(id = "", parent) {
this.exports = primitives.Object.create(Object.prototype);
this.path = dirname(id);
this.id = id;
this.filename = id;
this.loaded = false;
this.parent = parent;
}
get require() {
const require = requiresCache.get(this);
if (require)
return require;
const _require2 = Module$1.createRequire(this.id);
requiresCache.set(this, _require2);
return _require2;
}
static register = () => {
throw new Error(`[vitest] "register" is not available when running in Vitest.`);
};
_compile(code, filename) {
const cjsModule = Module$1.wrap(code);
const script = new vm.Script(cjsModule, {
filename,
importModuleDynamically: options.importModuleDynamically
});
script.identifier = filename;
const fn = script.runInContext(executor.context);
const __dirname = dirname(filename);
executor.requireCache.set(filename, this);
try {
fn(this.exports, this.require, this, filename, __dirname);
return this.exports;
} finally {
this.loaded = true;
}
}
// exposed for external use, Node.js does the opposite
static _load = (request, parent, _isMain) => {
const require = Module$1.createRequire((parent == null ? void 0 : parent.filename) ?? request);
return require(request);
};
static wrap = (script) => {
return Module$1.wrapper[0] + script + Module$1.wrapper[1];
};
static wrapper = new primitives.Array(
"(function (exports, require, module, __filename, __dirname) { ",
"\n});"
);
static builtinModules = Module.builtinModules;
static findSourceMap = Module.findSourceMap;
static SourceMap = Module.SourceMap;
static syncBuiltinESMExports = Module.syncBuiltinESMExports;
static _cache = executor.moduleCache;
static _extensions = executor.extensions;
static createRequire = (filename) => {
return executor.createRequire(filename);
};
static runMain = () => {
throw new primitives.Error('[vitest] "runMain" is not implemented.');
};
// @ts-expect-error not typed
static _resolveFilename = Module._resolveFilename;
// @ts-expect-error not typed
static _findPath = Module._findPath;
// @ts-expect-error not typed
static _initPaths = Module._initPaths;
// @ts-expect-error not typed
static _preloadModules = Module._preloadModules;
// @ts-expect-error not typed
static _resolveLookupPaths = Module._resolveLookupPaths;
// @ts-expect-error not typed
static globalPaths = Module.globalPaths;
static isBuiltin = Module.isBuiltin;
static Module = Module$1;
};
this.extensions[".js"] = this.requireJs;
this.extensions[".json"] = this.requireJson;
}
requireJs = (m, filename) => {
const content = this.fs.readFile(filename);
m._compile(content, filename);
};
requireJson = (m, filename) => {
const code = this.fs.readFile(filename);
m.exports = JSON.parse(code);
};
createRequire = (filename) => {
const _require2 = createRequire(filename);
const require = (id) => {
const resolved = _require2.resolve(id);
const ext = extname(resolved);
if (ext === ".node" || isNodeBuiltin(resolved))
return this.requireCoreModule(resolved);
const module = new this.Module(resolved);
return this.loadCommonJSModule(module, resolved);
};
require.resolve = _require2.resolve;
Object.defineProperty(require, "extensions", {
get: () => this.extensions,
set: () => {
},
configurable: true
});
require.main = void 0;
require.cache = this.publicRequireCache;
return require;
};
createProxyCache() {
return new Proxy(/* @__PURE__ */ Object.create(null), {
defineProperty: () => true,
deleteProperty: () => true,
set: () => true,
get: (_, key) => this.requireCache.get(key),
has: (_, key) => this.requireCache.has(key),
ownKeys: () => Array.from(this.requireCache.keys()),
getOwnPropertyDescriptor() {
return {
configurable: true,
enumerable: true
};
}
});
}
// very naive implementation for Node.js require
loadCommonJSModule(module, filename) {
const cached = this.requireCache.get(filename);
if (cached)
return cached.exports;
const extension = this.findLongestRegisteredExtension(filename);
const loader = this.extensions[extension] || this.extensions[".js"];
loader(module, filename);
return module.exports;
}
findLongestRegisteredExtension(filename) {
const name = basename(filename);
let currentExtension;
let index;
let startIndex = 0;
while ((index = name.indexOf(".", startIndex)) !== -1) {
startIndex = index + 1;
if (index === 0)
continue;
currentExtension = name.slice(index);
if (this.extensions[currentExtension])
return currentExtension;
}
return ".js";
}
require(identifier) {
const ext = extname(identifier);
if (ext === ".node" || isNodeBuiltin(identifier))
return this.requireCoreModule(identifier);
const module = new this.Module(identifier);
return this.loadCommonJSModule(module, identifier);
}
requireCoreModule(identifier) {
const normalized = identifier.replace(/^node:/, "");
if (this.builtinCache[normalized])
return this.builtinCache[normalized].exports;
const moduleExports = _require(identifier);
if (identifier === "node:module" || identifier === "module") {
const module = new this.Module("/module.js");
module.exports = this.Module;
this.builtinCache[normalized] = module;
return module.exports;
}
this.builtinCache[normalized] = _require.cache[normalized];
return moduleExports;
}
}
function interopCommonJsModule(interopDefault, mod) {
if (isPrimitive(mod) || Array.isArray(mod) || mod instanceof Promise) {
return {
keys: [],
moduleExports: {},
defaultExport: mod
};
}
if (interopDefault !== false && "__esModule" in mod && !isPrimitive(mod.default)) {
const defaultKets = Object.keys(mod.default);
const moduleKeys = Object.keys(mod);
const allKeys = /* @__PURE__ */ new Set([...defaultKets, ...moduleKeys]);
allKeys.delete("default");
return {
keys: Array.from(allKeys),
moduleExports: new Proxy(mod, {
get(mod2, prop) {
var _a;
return mod2[prop] ?? ((_a = mod2.default) == null ? void 0 : _a[prop]);
}
}),
defaultExport: mod
};
}
return {
keys: Object.keys(mod).filter((key) => key !== "default"),
moduleExports: mod,
defaultExport: mod
};
}
const SyntheticModule$1 = vm.SyntheticModule;
const SourceTextModule = vm.SourceTextModule;
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck$1 = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet$1 = (obj, member, getter) => {
__accessCheck$1(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd$1 = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var _httpIp;
const dataURIRegex = /^data:(?<mime>text\/javascript|application\/json|application\/wasm)(?:;(?<encoding>charset=utf-8|base64))?,(?<code>.*)$/;
class EsmExecutor {
constructor(executor, options) {
this.executor = executor;
__publicField$1(this, "moduleCache", /* @__PURE__ */ new Map());
__publicField$1(this, "esmLinkMap", /* @__PURE__ */ new WeakMap());
__publicField$1(this, "context");
__privateAdd$1(this, _httpIp, IPnumber("127.0.0.0"));
this.context = options.context;
}
async evaluateModule(m) {
if (m.status === "unlinked") {
this.esmLinkMap.set(
m,
m.link((identifier, referencer) => this.executor.resolveModule(identifier, referencer.identifier))
);
}
await this.esmLinkMap.get(m);
if (m.status === "linked")
await m.evaluate();
return m;
}
async createEsModule(fileUrl, getCode) {
const cached = this.moduleCache.get(fileUrl);
if (cached)
return cached;
const code = await getCode();
if (fileUrl.endsWith(".json")) {
const m2 = new SyntheticModule$1(
["default"],
() => {
const result = JSON.parse(code);
m2.setExport("default", result);
}
);
this.moduleCache.set(fileUrl, m2);
return m2;
}
const m = new SourceTextModule(
code,
{
identifier: fileUrl,
context: this.context,
importModuleDynamically: this.executor.importModuleDynamically,
initializeImportMeta: (meta, mod) => {
meta.url = mod.identifier;
if (mod.identifier.startsWith("file:")) {
const filename = fileURLToPath(mod.identifier);
meta.filename = filename;
meta.dirname = dirname$1(filename);
}
meta.resolve = (specifier, importer) => {
return this.executor.resolve(specifier, importer != null ? importer.toString() : mod.identifier);
};
}
}
);
this.moduleCache.set(fileUrl, m);
return m;
}
async createWebAssemblyModule(fileUrl, getCode) {
const cached = this.moduleCache.get(fileUrl);
if (cached)
return cached;
const m = this.loadWebAssemblyModule(getCode(), fileUrl);
this.moduleCache.set(fileUrl, m);
return m;
}
async createNetworkModule(fileUrl) {
if (fileUrl.startsWith("http:")) {
const url = new URL(fileUrl);
if (url.hostname !== "localhost" && url.hostname !== "::1" && (IPnumber(url.hostname) & IPmask(8)) !== __privateGet$1(this, _httpIp)) {
throw new Error(
// we don't know the importer, so it's undefined (the same happens in --pool=threads)
`import of '${fileUrl}' by undefined is not supported: http can only be used to load local resources (use https instead).`
);
}
}
return this.createEsModule(fileUrl, () => fetch(fileUrl).then((r) => r.text()));
}
async loadWebAssemblyModule(source, identifier) {
const cached = this.moduleCache.get(identifier);
if (cached)
return cached;
const wasmModule = await WebAssembly.compile(source);
const exports = WebAssembly.Module.exports(wasmModule);
const imports = WebAssembly.Module.imports(wasmModule);
const moduleLookup = {};
for (const { module } of imports) {
if (moduleLookup[module] === void 0) {
moduleLookup[module] = await this.executor.resolveModule(
module,
identifier
);
}
}
const syntheticModule = new SyntheticModule$1(
exports.map(({ name }) => name),
async () => {
const importsObject = {};
for (const { module, name } of imports) {
if (!importsObject[module])
importsObject[module] = {};
await this.evaluateModule(moduleLookup[module]);
importsObject[module][name] = moduleLookup[module].namespace[name];
}
const wasmInstance = new WebAssembly.Instance(
wasmModule,
importsObject
);
for (const { name } of exports)
syntheticModule.setExport(name, wasmInstance.exports[name]);
},
{ context: this.context, identifier }
);
return syntheticModule;
}
cacheModule(identifier, module) {
this.moduleCache.set(identifier, module);
}
resolveCachedModule(identifier) {
return this.moduleCache.get(identifier);
}
async createDataModule(identifier) {
const cached = this.moduleCache.get(identifier);
if (cached)
return cached;
const match = identifier.match(dataURIRegex);
if (!match || !match.groups)
throw new Error("Invalid data URI");
const mime = match.groups.mime;
const encoding = match.groups.encoding;
if (mime === "application/wasm") {
if (!encoding)
throw new Error("Missing data URI encoding");
if (encoding !== "base64")
throw new Error(`Invalid data URI encoding: ${encoding}`);
const module = this.loadWebAssemblyModule(
Buffer.from(match.groups.code, "base64"),
identifier
);
this.moduleCache.set(identifier, module);
return module;
}
let code = match.groups.code;
if (!encoding || encoding === "charset=utf-8")
code = decodeURIComponent(code);
else if (encoding === "base64")
code = Buffer.from(code, "base64").toString();
else
throw new Error(`Invalid data URI encoding: ${encoding}`);
if (mime === "application/json") {
const module = new SyntheticModule$1(
["default"],
() => {
const obj = JSON.parse(code);
module.setExport("default", obj);
},
{ context: this.context, identifier }
);
this.moduleCache.set(identifier, module);
return module;
}
return this.createEsModule(identifier, () => code);
}
}
_httpIp = new WeakMap();
function IPnumber(address) {
const ip = address.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
if (ip)
return (+ip[1] << 24) + (+ip[2] << 16) + (+ip[3] << 8) + +ip[4];
throw new Error(`Expected IP address, received ${address}`);
}
function IPmask(maskSize) {
return -1 << 32 - maskSize;
}
const CLIENT_ID = "/@vite/client";
const CLIENT_FILE = pathToFileURL(CLIENT_ID).href;
class ViteExecutor {
constructor(options) {
this.options = options;
this.esm = options.esmExecutor;
}
esm;
resolve = (identifier, parent) => {
if (identifier === CLIENT_ID) {
if (this.workerState.environment.transformMode === "web")
return identifier;
const packageName = this.getPackageName(parent);
throw new Error(
`[vitest] Vitest cannot handle ${CLIENT_ID} imported in ${parent} when running in SSR environment. Add "${packageName}" to "ssr.noExternal" if you are using Vite SSR, or to "server.deps.inline" if you are using Vite Node.`
);
}
};
get workerState() {
return this.options.context.__vitest_worker__;
}
getPackageName(modulePath) {
const path = normalize(modulePath);
let name = path.split("/node_modules/").pop() || "";
if (name == null ? void 0 : name.startsWith("@"))
name = name.split("/").slice(0, 2).join("/");
else
name = name.split("/")[0];
return name;
}
async createViteModule(fileUrl) {
if (fileUrl === CLIENT_FILE)
return this.createViteClientModule();
const cached = this.esm.resolveCachedModule(fileUrl);
if (cached)
return cached;
return this.esm.createEsModule(fileUrl, async () => {
const result = await this.options.transform(fileUrl, "web");
if (!result.code)
throw new Error(`[vitest] Failed to transform ${fileUrl}. Does the file exist?`);
return result.code;
});
}
createViteClientModule() {
const identifier = CLIENT_ID;
const cached = this.esm.resolveCachedModule(identifier);
if (cached)
return cached;
const stub = this.options.viteClientModule;
const moduleKeys = Object.keys(stub);
const module = new SyntheticModule$1(
moduleKeys,
() => {
moduleKeys.forEach((key) => {
module.setExport(key, stub[key]);
});
},
{ context: this.options.context, identifier }
);
this.esm.cacheModule(identifier, module);
return module;
}
canResolve = (fileUrl) => {
var _a;
const transformMode = this.workerState.environment.transformMode;
if (transformMode !== "web")
return false;
if (fileUrl === CLIENT_FILE)
return true;
const config = ((_a = this.workerState.config.deps) == null ? void 0 : _a.web) || {};
const [modulePath] = fileUrl.split("?");
if (config.transformCss && CSS_LANGS_RE.test(modulePath))
return true;
if (config.transformAssets && KNOWN_ASSET_RE.test(modulePath))
return true;
if (toArray(config.transformGlobPattern).some((pattern) => pattern.test(modulePath)))
return true;
return false;
};
}
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
var _networkSupported;
const SyntheticModule = vm.SyntheticModule;
const nativeResolve = import.meta.resolve;
class ExternalModulesExecutor {
constructor(options) {
this.options = options;
__publicField(this, "cjs");
__publicField(this, "esm");
__publicField(this, "vite");
__publicField(this, "context");
__publicField(this, "fs");
__publicField(this, "resolvers", []);
__privateAdd(this, _networkSupported, null);
// dynamic import can be used in both ESM and CJS, so we have it in the executor
__publicField(this, "importModuleDynamically", async (specifier, referencer) => {
const module = await this.resolveModule(specifier, referencer.identifier);
return this.esm.evaluateModule(module);
});
__publicField(this, "resolveModule", async (specifier, referencer) => {
let identifier = this.resolve(specifier, referencer);
if (identifier instanceof Promise)
identifier = await identifier;
return await this.createModule(identifier);
});
this.context = options.context;
this.fs = options.fileMap;
this.esm = new EsmExecutor(this, {
context: this.context
});
this.cjs = new CommonjsExecutor({
context: this.context,
importModuleDynamically: this.importModuleDynamically,
fileMap: options.fileMap
});
this.vite = new ViteExecutor({
esmExecutor: this.esm,
context: this.context,
transform: options.transform,
viteClientModule: options.viteClientModule
});
this.resolvers = [this.vite.resolve];
}
async import(identifier) {
const module = await this.createModule(identifier);
await this.esm.evaluateModule(module);
return module.namespace;
}
require(identifier) {
return this.cjs.require(identifier);
}
createRequire(identifier) {
return this.cjs.createRequire(identifier);
}
resolve(specifier, parent) {
for (const resolver of this.resolvers) {
const id = resolver(specifier, parent);
if (id)
return id;
}
return nativeResolve(specifier, parent);
}
findNearestPackageData(basedir) {
var _a;
const originalBasedir = basedir;
const packageCache = this.options.packageCache;
while (basedir) {
const cached = getCachedData(packageCache, basedir, originalBasedir);
if (cached)
return cached;
const pkgPath = join(basedir, "package.json");
try {
if ((_a = statSync(pkgPath, { throwIfNoEntry: false })) == null ? void 0 : _a.isFile()) {
const pkgData = JSON.parse(this.fs.readFile(pkgPath));
if (packageCache)
setCacheData(packageCache, pkgData, basedir, originalBasedir);
return pkgData;
}
} catch {
}
const nextBasedir = dirname$1(basedir);
if (nextBasedir === basedir)
break;
basedir = nextBasedir;
}
return {};
}
wrapCoreSynteticModule(identifier, exports) {
const moduleKeys = Object.keys(exports);
const m = new SyntheticModule(
[...moduleKeys, "default"],
() => {
for (const key of moduleKeys)
m.setExport(key, exports[key]);
m.setExport("default", exports);
},
{
context: this.context,
identifier
}
);
return m;
}
wrapCommonJsSynteticModule(identifier, exports) {
const { keys, moduleExports, defaultExport } = interopCommonJsModule(this.options.interopDefault, exports);
const m = new SyntheticModule(
[...keys, "default"],
() => {
for (const key of keys)
m.setExport(key, moduleExports[key]);
m.setExport("default", defaultExport);
},
{
context: this.context,
identifier
}
);
return m;
}
getModuleInformation(identifier) {
if (identifier.startsWith("data:"))
return { type: "data", url: identifier, path: identifier };
const extension = extname(identifier);
if (extension === ".node" || isNodeBuiltin(identifier))
return { type: "builtin", url: identifier, path: identifier };
if (this.isNetworkSupported && (identifier.startsWith("http:") || identifier.startsWith("https:")))
return { type: "network", url: identifier, path: identifier };
const isFileUrl = identifier.startsWith("file://");
const pathUrl = isFileUrl ? fileURLToPath(identifier.split("?")[0]) : identifier;
const fileUrl = isFileUrl ? identifier : pathToFileURL(pathUrl).toString();
let type;
if (this.vite.canResolve(fileUrl)) {
type = "vite";
} else if (extension === ".mjs") {
type = "module";
} else if (extension === ".cjs") {
type = "commonjs";
} else if (extension === ".wasm") {
type = "wasm";
} else {
const pkgData = this.findNearestPackageData(normalize(pathUrl));
type = pkgData.type === "module" ? "module" : "commonjs";
}
return { type, path: pathUrl, url: fileUrl };
}
async createModule(identifier) {
const { type, url, path } = this.getModuleInformation(identifier);
if ((type === "module" || type === "commonjs" || type === "wasm") && !existsSync(path)) {
const error = new Error(`Cannot find module '${path}'`);
error.code = "ERR_MODULE_NOT_FOUND";
throw error;
}
switch (type) {
case "data":
return this.esm.createDataModule(identifier);
case "builtin": {
const exports = this.require(identifier);
return this.wrapCoreSynteticModule(identifier, exports);
}
case "vite":
return await this.vite.createViteModule(url);
case "wasm":
return await this.esm.createWebAssemblyModule(url, () => this.fs.readBuffer(path));
case "module":
return await this.esm.createEsModule(url, () => this.fs.readFile(path));
case "commonjs": {
const exports = this.require(path);
return this.wrapCommonJsSynteticModule(identifier, exports);
}
case "network": {
return this.esm.createNetworkModule(url);
}
default: {
const _deadend = type;
return _deadend;
}
}
}
get isNetworkSupported() {
var _a;
if (__privateGet(this, _networkSupported) == null) {
if (process.execArgv.includes("--experimental-network-imports"))
__privateSet(this, _networkSupported, true);
else if ((_a = process.env.NODE_OPTIONS) == null ? void 0 : _a.includes("--experimental-network-imports"))
__privateSet(this, _networkSupported, true);
else
__privateSet(this, _networkSupported, false);
}
return __privateGet(this, _networkSupported);
}
}
_networkSupported = new WeakMap();
class FileMap {
fsCache = /* @__PURE__ */ new Map();
fsBufferCache = /* @__PURE__ */ new Map();
readFile(path) {
const cached = this.fsCache.get(path);
if (cached)
return cached;
const source = readFileSync(path, "utf-8");
this.fsCache.set(path, source);
return source;
}
readBuffer(path) {
const cached = this.fsBufferCache.get(path);
if (cached)
return cached;
const buffer = readFileSync(path);
this.fsBufferCache.set(path, buffer);
return buffer;
}
}
const entryFile = pathToFileURL(resolve(distDir, "workers/runVmTests.js")).href;
const fileMap = new FileMap();
const packageCache = /* @__PURE__ */ new Map();
async function runVmTests(state) {
var _a;
const { environment, ctx, rpc } = state;
if (!environment.setupVM) {
const envName = ctx.environment.name;
const packageId = envName[0] === "." ? envName : `vitest-environment-${envName}`;
throw new TypeError(
`Environment "${ctx.environment.name}" is not a valid environment. Path "${packageId}" doesn't support vm environment because it doesn't provide "setupVM" method.`
);
}
const vm = await environment.setupVM(ctx.environment.options || ctx.config.environmentOptions || {});
state.durations.environment = performance.now() - state.durations.environment;
process.env.VITEST_VM_POOL = "1";
if (!vm.getVmContext)
throw new TypeError(`Environment ${environment.name} doesn't provide "getVmContext" method. It should return a context created by "vm.createContext" method.`);
const context = vm.getVmContext();
if (!isContext(context))
throw new TypeError(`Environment ${environment.name} doesn't provide a valid context. It should be created by "vm.createContext" method.`);
provideWorkerState(context, state);
context.process = process;
context.global = context;
context.console = state.config.disableConsoleIntercept ? console : createCustomConsole();
context.setImmediate = setImmediate;
context.clearImmediate = clearImmediate;
const stubs = getDefaultRequestStubs(context);
const externalModulesExecutor = new ExternalModulesExecutor({
context,
fileMap,
packageCache,
transform: rpc.transform,
viteClientModule: stubs["/@vite/client"]
});
const executor = await startVitestExecutor({
context,
moduleCache: state.moduleCache,
mockMap: state.mockMap,
state,
externalModulesExecutor,
requestStubs: stubs
});
context.__vitest_mocker__ = executor.mocker;
const { run } = await executor.importExternalModule(entryFile);
try {
await run(ctx.files, ctx.config, executor);
} finally {
await ((_a = vm.teardown) == null ? void 0 : _a.call(vm));
state.environmentTeardownRun = true;
}
}
export { runVmTests as r };

107
control-plane-ui/node_modules/vitest/dist/worker.js generated vendored Normal file
View File

@@ -0,0 +1,107 @@
import { pathToFileURL } from 'node:url';
import { workerId } from 'tinypool';
import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
import { readFileSync } from 'node:fs';
import { resolve, normalize } from 'pathe';
import { e as environments } from './vendor/index.GVFv9dZ0.js';
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.5NT-gWu5.js';
import { s as setupInspect } from './vendor/inspector.IgLX3ur5.js';
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.joBhAkyK.js';
import 'node:console';
import '@vitest/utils';
import 'node:module';
import './vendor/index.8bPxjt7g.js';
import './vendor/global.CkGT_TMy.js';
function isBuiltinEnvironment(env) {
return env in environments;
}
const _loaders = /* @__PURE__ */ new Map();
async function createEnvironmentLoader(options) {
if (!_loaders.has(options.root)) {
const loader = new ViteNodeRunner(options);
await loader.executeId("/@vite/env");
_loaders.set(options.root, loader);
}
return _loaders.get(options.root);
}
async function loadEnvironment(ctx, rpc) {
var _a;
const name = ctx.environment.name;
if (isBuiltinEnvironment(name))
return environments[name];
const loader = await createEnvironmentLoader({
root: ctx.config.root,
fetchModule: async (id) => {
const result = await rpc.fetch(id, "ssr");
if (result.id)
return { code: readFileSync(result.id, "utf-8") };
return result;
},
resolveId: (id, importer) => rpc.resolveId(id, importer, "ssr")
});
const root = loader.root;
const packageId = name[0] === "." || name[0] === "/" ? resolve(root, name) : ((_a = await rpc.resolveId(`vitest-environment-${name}`, void 0, "ssr")) == null ? void 0 : _a.id) ?? resolve(root, name);
const pkg = await loader.executeId(normalize(packageId));
if (!pkg || !pkg.default || typeof pkg.default !== "object") {
throw new TypeError(
`Environment "${name}" is not a valid environment. Path "${packageId}" should export default object with a "setup" or/and "setupVM" method.`
);
}
const environment = pkg.default;
if (environment.transformMode !== "web" && environment.transformMode !== "ssr") {
throw new TypeError(
`Environment "${name}" is not a valid environment. Path "${packageId}" should export default object with a "transformMode" method equal to "ssr" or "web".`
);
}
return environment;
}
if (isChildProcess())
setProcessTitle(`vitest ${workerId}`);
async function run(ctx) {
const prepareStart = performance.now();
const inspectorCleanup = setupInspect(ctx);
process.env.VITEST_WORKER_ID = String(ctx.workerId);
process.env.VITEST_POOL_ID = String(workerId);
try {
if (ctx.worker[0] === ".")
throw new Error(`Path to the test runner cannot be relative, received "${ctx.worker}"`);
const file = ctx.worker.startsWith("file:") ? ctx.worker : pathToFileURL(ctx.worker).toString();
const testRunnerModule = await import(file);
if (!testRunnerModule.default || typeof testRunnerModule.default !== "object")
throw new TypeError(`Test worker object should be exposed as a default export. Received "${typeof testRunnerModule.default}"`);
const worker = testRunnerModule.default;
if (!worker.getRpcOptions || typeof worker.getRpcOptions !== "function")
throw new TypeError(`Test worker should expose "getRpcOptions" method. Received "${typeof worker.getRpcOptions}".`);
const { rpc, onCancel } = createRuntimeRpc(worker.getRpcOptions(ctx));
const beforeEnvironmentTime = performance.now();
const environment = await loadEnvironment(ctx, rpc);
if (ctx.environment.transformMode)
environment.transformMode = ctx.environment.transformMode;
const state = {
ctx,
// here we create a new one, workers can reassign this if they need to keep it non-isolated
moduleCache: new ModuleCacheMap(),
mockMap: /* @__PURE__ */ new Map(),
config: ctx.config,
onCancel,
environment,
durations: {
environment: beforeEnvironmentTime,
prepare: prepareStart
},
rpc,
providedContext: ctx.providedContext
};
if (!worker.runTests || typeof worker.runTests !== "function")
throw new TypeError(`Test worker should expose "runTests" method. Received "${typeof worker.runTests}".`);
await worker.runTests(state);
} finally {
await rpcDone().catch(() => {
});
inspectorCleanup();
}
}
export { run };

40
control-plane-ui/node_modules/vitest/dist/workers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import * as v8 from 'v8';
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-w_64AS5f.js';
import { Awaitable } from '@vitest/utils';
import 'vite';
import '@vitest/runner';
import 'vite-node';
import '@vitest/snapshot';
import '@vitest/expect';
import '@vitest/runner/utils';
import 'tinybench';
import 'node:stream';
import 'vite-node/client';
import '@vitest/snapshot/manager';
import 'vite-node/server';
import 'node:worker_threads';
import 'node:fs';
import 'chai';
type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serialize' | 'deserialize'>;
interface VitestWorker {
getRpcOptions: (ctx: ContextRPC) => WorkerRpcOptions;
runTests: (state: WorkerGlobalState) => Awaitable<unknown>;
}
declare function createThreadsRpcOptions({ port }: WorkerContext): WorkerRpcOptions;
declare function createForksRpcOptions(nodeV8: typeof v8): WorkerRpcOptions;
/**
* Reverts the wrapping done by `utils/config-helpers.ts`'s `wrapSerializableConfig`
*/
declare function unwrapSerializableConfig(config: ResolvedConfig): ResolvedConfig;
declare function provideWorkerState(context: any, state: WorkerGlobalState): WorkerGlobalState;
declare function run(ctx: ContextRPC): Promise<void>;
declare function runVmTests(state: WorkerGlobalState): Promise<void>;
declare function runBaseTests(state: WorkerGlobalState): Promise<void>;
export { type VitestWorker, type WorkerRpcOptions, createForksRpcOptions, createThreadsRpcOptions, provideWorkerState, runBaseTests, run as runVitestWorker, runVmTests, unwrapSerializableConfig };

31
control-plane-ui/node_modules/vitest/dist/workers.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.0uYuCbzo.js';
export { p as provideWorkerState } from './vendor/global.CkGT_TMy.js';
export { run as runVitestWorker } from './worker.js';
export { r as runVmTests } from './vendor/vm.QEE48c0T.js';
export { r as runBaseTests } from './vendor/base.Ybri3C14.js';
import '@vitest/utils';
import 'node:url';
import 'tinypool';
import 'vite-node/client';
import 'node:fs';
import 'pathe';
import './vendor/index.GVFv9dZ0.js';
import 'node:console';
import './vendor/base.5NT-gWu5.js';
import './vendor/inspector.IgLX3ur5.js';
import 'node:module';
import './vendor/rpc.joBhAkyK.js';
import './vendor/index.8bPxjt7g.js';
import 'node:vm';
import './chunks/runtime-console.EO5ha7qv.js';
import 'node:stream';
import 'node:path';
import './vendor/date.Ns1pGd_X.js';
import '@vitest/runner/utils';
import './vendor/env.AtSIuHFg.js';
import 'std-env';
import './vendor/execute.fL3szUAI.js';
import 'vite-node/utils';
import '@vitest/utils/error';
import './path.js';
import 'vite-node/constants';

View File

@@ -0,0 +1,33 @@
import v8 from 'node:v8';
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.0uYuCbzo.js';
import { r as runBaseTests } from '../vendor/base.Ybri3C14.js';
import '@vitest/utils';
import 'vite-node/client';
import '../vendor/global.CkGT_TMy.js';
import '../vendor/execute.fL3szUAI.js';
import 'node:vm';
import 'node:url';
import 'node:fs';
import 'vite-node/utils';
import 'pathe';
import '@vitest/utils/error';
import '../path.js';
import '../vendor/base.5NT-gWu5.js';
class ForksBaseWorker {
getRpcOptions() {
return createForksRpcOptions(v8);
}
async runTests(state) {
const exit = process.exit;
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
try {
await runBaseTests(state);
} finally {
process.exit = exit;
}
}
}
var forks = new ForksBaseWorker();
export { forks as default };

View File

@@ -0,0 +1,84 @@
import { isatty } from 'node:tty';
import { createRequire } from 'node:module';
import util from 'node:util';
import timers from 'node:timers';
import { performance } from 'node:perf_hooks';
import { startTests } from '@vitest/runner';
import { setupColors, createColors } from '@vitest/utils';
import { installSourcemapsSupport } from 'vite-node/source-map';
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.DpVgvm2P.js';
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
import { V as VitestIndex } from '../vendor/index.dI9lHwVn.js';
import { s as setupCommonEnv } from '../vendor/setup-common.8nJLd4ay.js';
import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
import 'chai';
import 'pathe';
import '../path.js';
import 'node:url';
import '../vendor/rpc.joBhAkyK.js';
import '../vendor/index.8bPxjt7g.js';
import '../vendor/benchmark.yGkUTKnC.js';
import '@vitest/runner/utils';
import '../vendor/index.SMVOaj7F.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
import '../vendor/run-once.Olz_Zkd8.js';
import '../vendor/vi.YFlodzP_.js';
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
import '@vitest/expect';
import '@vitest/snapshot';
import '@vitest/utils/error';
import '../vendor/tasks.IknbGB2n.js';
import '@vitest/utils/source-map';
import '../vendor/base.5NT-gWu5.js';
import '../vendor/date.Ns1pGd_X.js';
import '@vitest/spy';
async function run(files, config, executor) {
const workerState = getWorkerState();
await setupCommonEnv(config);
Object.defineProperty(globalThis, "__vitest_index__", {
value: VitestIndex,
enumerable: false
});
setupColors(createColors(isatty(1)));
if (workerState.environment.transformMode === "web") {
const _require = createRequire(import.meta.url);
_require.extensions[".css"] = () => ({});
_require.extensions[".scss"] = () => ({});
_require.extensions[".sass"] = () => ({});
_require.extensions[".less"] = () => ({});
}
globalThis.__vitest_required__ = {
util,
timers
};
installSourcemapsSupport({
getSourceMap: (source) => workerState.moduleCache.getSourceMap(source)
});
await startCoverageInsideWorker(config.coverage, executor);
if (config.chaiConfig)
setupChaiConfig(config.chaiConfig);
const [runner, snapshotEnvironment] = await Promise.all([
resolveTestRunner(config, executor),
resolveSnapshotEnvironment(config, executor)
]);
config.snapshotOptions.snapshotEnvironment = snapshotEnvironment;
workerState.onCancel.then((reason) => {
var _a;
closeInspector(config);
(_a = runner.onCancel) == null ? void 0 : _a.call(runner, reason);
});
workerState.durations.prepare = performance.now() - workerState.durations.prepare;
const { vi } = VitestIndex;
for (const file of files) {
workerState.filepath = file;
await startTests([file], runner);
vi.resetConfig();
vi.restoreAllMocks();
}
await stopCoverageInsideWorker(config.coverage, executor);
}
export { run };

View File

@@ -0,0 +1,26 @@
import { r as runBaseTests } from '../vendor/base.Ybri3C14.js';
import { a as createThreadsRpcOptions } from '../vendor/utils.0uYuCbzo.js';
import 'vite-node/client';
import '../vendor/global.CkGT_TMy.js';
import '../vendor/execute.fL3szUAI.js';
import 'node:vm';
import 'node:url';
import 'node:fs';
import 'vite-node/utils';
import 'pathe';
import '@vitest/utils/error';
import '../path.js';
import '@vitest/utils';
import '../vendor/base.5NT-gWu5.js';
class ThreadsBaseWorker {
getRpcOptions(ctx) {
return createThreadsRpcOptions(ctx);
}
runTests(state) {
return runBaseTests(state);
}
}
var threads = new ThreadsBaseWorker();
export { threads as default };

View File

@@ -0,0 +1,43 @@
import v8 from 'node:v8';
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.0uYuCbzo.js';
import { r as runVmTests } from '../vendor/vm.QEE48c0T.js';
import '@vitest/utils';
import 'node:vm';
import 'node:url';
import 'pathe';
import '../chunks/runtime-console.EO5ha7qv.js';
import 'node:stream';
import 'node:console';
import 'node:path';
import '../vendor/date.Ns1pGd_X.js';
import '@vitest/runner/utils';
import '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
import '../vendor/execute.fL3szUAI.js';
import 'node:fs';
import 'vite-node/client';
import 'vite-node/utils';
import '@vitest/utils/error';
import '../path.js';
import '../vendor/base.5NT-gWu5.js';
import 'node:module';
import 'vite-node/constants';
class ForksVmWorker {
getRpcOptions() {
return createForksRpcOptions(v8);
}
async runTests(state) {
const exit = process.exit;
state.ctx.config = unwrapSerializableConfig(state.ctx.config);
try {
await runVmTests(state);
} finally {
process.exit = exit;
}
}
}
var vmForks = new ForksVmWorker();
export { vmForks as default };

View File

@@ -0,0 +1,36 @@
import { a as createThreadsRpcOptions } from '../vendor/utils.0uYuCbzo.js';
import { r as runVmTests } from '../vendor/vm.QEE48c0T.js';
import '@vitest/utils';
import 'node:vm';
import 'node:url';
import 'pathe';
import '../chunks/runtime-console.EO5ha7qv.js';
import 'node:stream';
import 'node:console';
import 'node:path';
import '../vendor/date.Ns1pGd_X.js';
import '@vitest/runner/utils';
import '../vendor/global.CkGT_TMy.js';
import '../vendor/env.AtSIuHFg.js';
import 'std-env';
import '../vendor/execute.fL3szUAI.js';
import 'node:fs';
import 'vite-node/client';
import 'vite-node/utils';
import '@vitest/utils/error';
import '../path.js';
import '../vendor/base.5NT-gWu5.js';
import 'node:module';
import 'vite-node/constants';
class ThreadsVmWorker {
getRpcOptions(ctx) {
return createThreadsRpcOptions(ctx);
}
runTests(state) {
return runVmTests(state);
}
}
var vmThreads = new ThreadsVmWorker();
export { vmThreads as default };

View File

@@ -0,0 +1 @@
export * from './dist/environments'

1
control-plane-ui/node_modules/vitest/execute.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/execute.js'

19
control-plane-ui/node_modules/vitest/globals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
declare global {
const suite: typeof import('vitest')['suite']
const test: typeof import('vitest')['test']
const describe: typeof import('vitest')['describe']
const it: typeof import('vitest')['it']
const expectTypeOf: typeof import('vitest')['expectTypeOf']
const assertType: typeof import('vitest')['assertType']
const expect: typeof import('vitest')['expect']
const assert: typeof import('vitest')['assert']
const vitest: typeof import('vitest')['vitest']
const vi: typeof import('vitest')['vitest']
const beforeAll: typeof import('vitest')['beforeAll']
const afterAll: typeof import('vitest')['afterAll']
const beforeEach: typeof import('vitest')['beforeEach']
const afterEach: typeof import('vitest')['afterEach']
const onTestFailed: typeof import('vitest')['onTestFailed']
const onTestFinished: typeof import('vitest')['onTestFinished']
}
export {}

View File

@@ -0,0 +1,5 @@
/// <reference path="./importMeta.d.ts" />
// https://github.com/microsoft/TypeScript/issues/45096
// TypeScript has a bug that makes <reference types="vite/types/importMeta" />
// not possible in userland. This file provides a workaround for now.

4
control-plane-ui/node_modules/vitest/importMeta.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
interface ImportMeta {
url: string
readonly vitest?: typeof import('vitest')
}

5
control-plane-ui/node_modules/vitest/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,5 @@
throw new Error(
'Vitest cannot be imported in a CommonJS module using require(). Please use "import" instead.'
+ '\n\nIf you are using "import" in your source code, then it\'s possible it was bundled into require() automatically by your bundler. '
+ 'In that case, do not bundle CommonJS output since it will never work with Vitest, or use dynamic import() which is available in all CommonJS modules.',
)

1
control-plane-ui/node_modules/vitest/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/index.js'

6
control-plane-ui/node_modules/vitest/jsdom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { JSDOM } from 'jsdom'
declare global {
const jsdom: JSDOM
}
export {}

1
control-plane-ui/node_modules/vitest/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/node.js'

203
control-plane-ui/node_modules/vitest/package.json generated vendored Normal file
View File

@@ -0,0 +1,203 @@
{
"name": "vitest",
"type": "module",
"version": "1.6.1",
"description": "Next generation testing framework powered by Vite",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
"homepage": "https://github.com/vitest-dev/vitest#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vitest-dev/vitest.git",
"directory": "packages/vitest"
},
"bugs": {
"url": "https://github.com/vitest-dev/vitest/issues"
},
"keywords": [
"vite",
"vite-node",
"vitest",
"test",
"jest"
],
"sideEffects": false,
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./index.d.cts",
"default": "./index.cjs"
}
},
"./*": "./*",
"./globals": {
"types": "./globals.d.ts"
},
"./jsdom": {
"types": "./jsdom.d.ts"
},
"./importMeta": {
"types": "./importMeta.d.ts"
},
"./import-meta": {
"types": "./import-meta.d.ts"
},
"./node": {
"types": "./dist/node.d.ts",
"default": "./dist/node.js"
},
"./execute": {
"types": "./dist/execute.d.ts",
"default": "./dist/execute.js"
},
"./workers": {
"types": "./dist/workers.d.ts",
"import": "./dist/workers.js"
},
"./browser": {
"types": "./dist/browser.d.ts",
"default": "./dist/browser.js"
},
"./runners": {
"types": "./dist/runners.d.ts",
"default": "./dist/runners.js"
},
"./suite": {
"types": "./dist/suite.d.ts",
"default": "./dist/suite.js"
},
"./environments": {
"types": "./dist/environments.d.ts",
"default": "./dist/environments.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"default": "./dist/utils.js"
},
"./config": {
"types": "./config.d.ts",
"require": "./dist/config.cjs",
"default": "./dist/config.js"
},
"./coverage": {
"types": "./coverage.d.ts",
"default": "./dist/coverage.js"
},
"./reporters": {
"types": "./dist/reporters.d.ts",
"default": "./dist/reporters.js"
},
"./snapshot": {
"types": "./dist/snapshot.d.ts",
"default": "./dist/snapshot.js"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"vitest": "./vitest.mjs"
},
"files": [
"*.cjs",
"*.d.cts",
"*.d.ts",
"*.mjs",
"bin",
"dist"
],
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
"peerDependencies": {
"@edge-runtime/vm": "*",
"@types/node": "^18.0.0 || >=20.0.0",
"happy-dom": "*",
"jsdom": "*",
"@vitest/ui": "1.6.1",
"@vitest/browser": "1.6.1"
},
"peerDependenciesMeta": {
"@edge-runtime/vm": {
"optional": true
},
"@types/node": {
"optional": true
},
"@vitest/browser": {
"optional": true
},
"@vitest/ui": {
"optional": true
},
"happy-dom": {
"optional": true
},
"jsdom": {
"optional": true
}
},
"dependencies": {
"acorn-walk": "^8.3.2",
"chai": "^4.3.10",
"debug": "^4.3.4",
"execa": "^8.0.1",
"local-pkg": "^0.5.0",
"magic-string": "^0.30.5",
"pathe": "^1.1.1",
"picocolors": "^1.0.0",
"std-env": "^3.5.0",
"strip-literal": "^2.0.0",
"tinybench": "^2.5.1",
"tinypool": "^0.8.3",
"vite": "^5.0.0",
"why-is-node-running": "^2.2.2",
"@vitest/runner": "1.6.1",
"@vitest/expect": "1.6.1",
"@vitest/spy": "1.6.1",
"@vitest/utils": "1.6.1",
"vite-node": "1.6.1",
"@vitest/snapshot": "1.6.1"
},
"devDependencies": {
"@ampproject/remapping": "^2.2.1",
"@antfu/install-pkg": "^0.3.1",
"@edge-runtime/vm": "^3.1.8",
"@sinonjs/fake-timers": "11.1.0",
"@types/estree": "^1.0.5",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-reports": "^3.0.4",
"@types/jsdom": "^21.1.6",
"@types/micromatch": "^4.0.6",
"@types/node": "^20.11.5",
"@types/prompts": "^2.4.9",
"@types/sinonjs__fake-timers": "^8.1.5",
"birpc": "0.2.15",
"cac": "^6.7.14",
"chai-subset": "^1.6.0",
"cli-truncate": "^4.0.0",
"expect-type": "^0.17.3",
"fast-glob": "^3.3.2",
"find-up": "^6.3.0",
"flatted": "^3.2.9",
"get-tsconfig": "^4.7.3",
"happy-dom": "^14.3.10",
"jsdom": "^24.0.0",
"log-update": "^5.0.1",
"micromatch": "^4.0.5",
"p-limit": "^5.0.0",
"pretty-format": "^29.7.0",
"prompts": "^2.4.2",
"strip-ansi": "^7.1.0",
"ws": "^8.14.2"
},
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline"
}
}

1
control-plane-ui/node_modules/vitest/reporters.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/reporters.js'

1
control-plane-ui/node_modules/vitest/runners.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/runners.js'

1
control-plane-ui/node_modules/vitest/snapshot.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/snapshot.js'

1
control-plane-ui/node_modules/vitest/suite.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/suite.js'

View File

@@ -0,0 +1,23 @@
// borrowed from tsx implementation:
// https://github.com/esbuild-kit/tsx
const ignoreWarnings = new Set([
'--experimental-loader is an experimental feature. This feature could change at any time',
'Custom ESM Loaders is an experimental feature. This feature could change at any time',
'Custom ESM Loaders is an experimental feature and might change at any time',
'VM Modules is an experimental feature and might change at any time',
'VM Modules is an experimental feature. This feature could change at any time',
])
const { emit } = process
process.emit = function (event, warning) {
if (
event === 'warning'
&& ignoreWarnings.has(warning.message)
)
return
// eslint-disable-next-line prefer-rest-params
return Reflect.apply(emit, this, arguments)
}

1
control-plane-ui/node_modules/vitest/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/utils.js'

2
control-plane-ui/node_modules/vitest/vitest.mjs generated vendored Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
import './dist/cli-wrapper.js'

1
control-plane-ui/node_modules/vitest/workers.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/workers.js'