Files
headroom/frontend/node_modules/vitest/dist/chunks/utils.CAioKnHs.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
2026-02-17 16:19:59 -05:00

62 lines
1.9 KiB
JavaScript

import { parseRegexp } from '@vitest/utils';
const REGEXP_WRAP_PREFIX = "$$vitest:";
// Store global APIs in case process is overwritten by tests
const processSend = process.send?.bind(process);
const processOn = process.on?.bind(process);
const processOff = process.off?.bind(process);
const dispose = [];
function createThreadsRpcOptions({ port }) {
return {
post: (v) => {
port.postMessage(v);
},
on: (fn) => {
port.addListener("message", fn);
}
};
}
function disposeInternalListeners() {
for (const fn of dispose) try {
fn();
} catch {}
dispose.length = 0;
}
function createForksRpcOptions(nodeV8) {
return {
serialize: nodeV8.serialize,
deserialize: (v) => nodeV8.deserialize(Buffer.from(v)),
post(v) {
processSend(v);
},
on(fn) {
const handler = (message, ...extras) => {
// Do not react on Tinypool's internal messaging
if (message?.__tinypool_worker_message__) return;
return fn(message, ...extras);
};
processOn("message", handler);
dispose.push(() => processOff("message", handler));
}
};
}
/**
* Reverts the wrapping done by `utils/config-helpers.ts`'s `wrapSerializableConfig`
*/
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 = {};
// Apply all keys from the original. Entries which had undefined value are missing from original now
for (const key of keys) defines[key] = original[key];
config.defines = defines;
}
return config;
}
export { createThreadsRpcOptions as a, createForksRpcOptions as c, disposeInternalListeners as d, unwrapSerializableConfig as u };