Files
headroom/frontend/node_modules/fast-check/lib/check/property/TimeoutProperty.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

48 lines
1.7 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeoutProperty = void 0;
const globals_1 = require("../../utils/globals");
const timeoutAfter = (timeMs, setTimeoutSafe, clearTimeoutSafe) => {
let timeoutHandle = null;
const promise = new Promise((resolve) => {
timeoutHandle = setTimeoutSafe(() => {
resolve({
error: new globals_1.Error(`Property timeout: exceeded limit of ${timeMs} milliseconds`),
errorMessage: `Property timeout: exceeded limit of ${timeMs} milliseconds`,
});
}, timeMs);
});
return {
clear: () => clearTimeoutSafe(timeoutHandle),
promise,
};
};
class TimeoutProperty {
constructor(property, timeMs, setTimeoutSafe, clearTimeoutSafe) {
this.property = property;
this.timeMs = timeMs;
this.setTimeoutSafe = setTimeoutSafe;
this.clearTimeoutSafe = clearTimeoutSafe;
if (this.property.runBeforeEach !== undefined && this.property.runAfterEach !== undefined) {
this.runBeforeEach = () => Promise.resolve(this.property.runBeforeEach());
this.runAfterEach = () => Promise.resolve(this.property.runAfterEach());
}
}
isAsync() {
return true;
}
generate(mrng, runId) {
return this.property.generate(mrng, runId);
}
shrink(value) {
return this.property.shrink(value);
}
async run(v, dontRunHook) {
const t = timeoutAfter(this.timeMs, this.setTimeoutSafe, this.clearTimeoutSafe);
const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);
propRun.then(t.clear, t.clear);
return propRun;
}
}
exports.TimeoutProperty = TimeoutProperty;