LittleDemon WebShell


Linux premium331.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
Path : /home/livedhms/lmgt/node_modules/fast-check/lib/check/property/
File Upload :
Command :
Current File : /home/livedhms/lmgt/node_modules/fast-check/lib/check/property/SkipAfterProperty.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SkipAfterProperty = void 0;
const PreconditionFailure_1 = require("../precondition/PreconditionFailure");
function interruptAfter(timeMs, setTimeoutSafe, clearTimeoutSafe) {
    let timeoutHandle = null;
    const promise = new Promise((resolve) => {
        timeoutHandle = setTimeoutSafe(() => {
            const preconditionFailure = new PreconditionFailure_1.PreconditionFailure(true);
            resolve(preconditionFailure);
        }, timeMs);
    });
    return {
        clear: () => clearTimeoutSafe(timeoutHandle),
        promise,
    };
}
class SkipAfterProperty {
    constructor(property, getTime, timeLimit, interruptExecution, setTimeoutSafe, clearTimeoutSafe) {
        this.property = property;
        this.getTime = getTime;
        this.interruptExecution = interruptExecution;
        this.setTimeoutSafe = setTimeoutSafe;
        this.clearTimeoutSafe = clearTimeoutSafe;
        this.skipAfterTime = this.getTime() + timeLimit;
        if (this.property.runBeforeEach !== undefined && this.property.runAfterEach !== undefined) {
            this.runBeforeEach = () => this.property.runBeforeEach();
            this.runAfterEach = () => this.property.runAfterEach();
        }
    }
    isAsync() {
        return this.property.isAsync();
    }
    generate(mrng, runId) {
        return this.property.generate(mrng, runId);
    }
    shrink(value) {
        return this.property.shrink(value);
    }
    run(v, dontRunHook) {
        const remainingTime = this.skipAfterTime - this.getTime();
        if (remainingTime <= 0) {
            const preconditionFailure = new PreconditionFailure_1.PreconditionFailure(this.interruptExecution);
            if (this.isAsync()) {
                return Promise.resolve(preconditionFailure);
            }
            else {
                return preconditionFailure;
            }
        }
        if (this.interruptExecution && this.isAsync()) {
            const t = interruptAfter(remainingTime, this.setTimeoutSafe, this.clearTimeoutSafe);
            const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);
            propRun.then(t.clear, t.clear);
            return propRun;
        }
        return this.property.run(v, dontRunHook);
    }
}
exports.SkipAfterProperty = SkipAfterProperty;

LittleDemon - FACEBOOK
[ KELUAR ]