Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-check

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-check - npm Package Compare versions

Comparing version 3.5.0 to 3.5.1

12

lib/check/property/SkipAfterProperty.js

@@ -5,6 +5,6 @@ "use strict";

const PreconditionFailure_1 = require("../precondition/PreconditionFailure");
function interruptAfter(timeMs) {
function interruptAfter(timeMs, setTimeoutSafe, clearTimeoutSafe) {
let timeoutHandle = null;
const promise = new Promise((resolve) => {
timeoutHandle = setTimeout(() => {
timeoutHandle = setTimeoutSafe(() => {
const preconditionFailure = new PreconditionFailure_1.PreconditionFailure(true);

@@ -15,3 +15,3 @@ resolve(preconditionFailure);

return {
clear: () => clearTimeout(timeoutHandle),
clear: () => clearTimeoutSafe(timeoutHandle),
promise,

@@ -21,6 +21,8 @@ };

class SkipAfterProperty {
constructor(property, getTime, timeLimit, interruptExecution) {
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;

@@ -53,3 +55,3 @@ if (this.property.runBeforeEach !== undefined && this.property.runAfterEach !== undefined) {

if (this.interruptExecution && this.isAsync()) {
const t = interruptAfter(remainingTime);
const t = interruptAfter(remainingTime, this.setTimeoutSafe, this.clearTimeoutSafe);
const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);

@@ -56,0 +58,0 @@ propRun.then(t.clear, t.clear);

@@ -5,6 +5,6 @@ "use strict";

const globals_1 = require("../../utils/globals");
const timeoutAfter = (timeMs) => {
const timeoutAfter = (timeMs, setTimeoutSafe, clearTimeoutSafe) => {
let timeoutHandle = null;
const promise = new Promise((resolve) => {
timeoutHandle = setTimeout(() => {
timeoutHandle = setTimeoutSafe(() => {
resolve({

@@ -17,3 +17,3 @@ error: new globals_1.Error(`Property timeout: exceeded limit of ${timeMs} milliseconds`),

return {
clear: () => clearTimeout(timeoutHandle),
clear: () => clearTimeoutSafe(timeoutHandle),
promise,

@@ -23,5 +23,7 @@ };

class TimeoutProperty {
constructor(property, timeMs) {
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) {

@@ -42,3 +44,3 @@ this.runBeforeEach = () => Promise.resolve(this.property.runBeforeEach());

async run(v, dontRunHook) {
const t = timeoutAfter(this.timeMs);
const t = timeoutAfter(this.timeMs, this.setTimeoutSafe, this.clearTimeoutSafe);
const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);

@@ -45,0 +47,0 @@ propRun.then(t.clear, t.clear);

@@ -9,6 +9,8 @@ "use strict";

const safeDateNow = Date.now;
const safeSetTimeout = setTimeout;
const safeClearTimeout = clearTimeout;
function decorateProperty(rawProperty, qParams) {
let prop = rawProperty;
if (rawProperty.isAsync() && qParams.timeout != null) {
prop = new TimeoutProperty_1.TimeoutProperty(prop, qParams.timeout);
prop = new TimeoutProperty_1.TimeoutProperty(prop, qParams.timeout, safeSetTimeout, safeClearTimeout);
}

@@ -19,6 +21,6 @@ if (qParams.unbiased) {

if (qParams.skipAllAfterTimeLimit != null) {
prop = new SkipAfterProperty_1.SkipAfterProperty(prop, safeDateNow, qParams.skipAllAfterTimeLimit, false);
prop = new SkipAfterProperty_1.SkipAfterProperty(prop, safeDateNow, qParams.skipAllAfterTimeLimit, false, safeSetTimeout, safeClearTimeout);
}
if (qParams.interruptAfterTimeLimit != null) {
prop = new SkipAfterProperty_1.SkipAfterProperty(prop, safeDateNow, qParams.interruptAfterTimeLimit, true);
prop = new SkipAfterProperty_1.SkipAfterProperty(prop, safeDateNow, qParams.interruptAfterTimeLimit, true, safeSetTimeout, safeClearTimeout);
}

@@ -25,0 +27,0 @@ if (qParams.skipEqualValues) {

import { PreconditionFailure } from '../precondition/PreconditionFailure.js';
function interruptAfter(timeMs) {
function interruptAfter(timeMs, setTimeoutSafe, clearTimeoutSafe) {
let timeoutHandle = null;
const promise = new Promise((resolve) => {
timeoutHandle = setTimeout(() => {
timeoutHandle = setTimeoutSafe(() => {
const preconditionFailure = new PreconditionFailure(true);

@@ -11,3 +11,3 @@ resolve(preconditionFailure);

return {
clear: () => clearTimeout(timeoutHandle),
clear: () => clearTimeoutSafe(timeoutHandle),
promise,

@@ -17,6 +17,8 @@ };

export class SkipAfterProperty {
constructor(property, getTime, timeLimit, interruptExecution) {
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;

@@ -49,3 +51,3 @@ if (this.property.runBeforeEach !== undefined && this.property.runAfterEach !== undefined) {

if (this.interruptExecution && this.isAsync()) {
const t = interruptAfter(remainingTime);
const t = interruptAfter(remainingTime, this.setTimeoutSafe, this.clearTimeoutSafe);
const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);

@@ -52,0 +54,0 @@ propRun.then(t.clear, t.clear);

import { Error } from '../../utils/globals.js';
const timeoutAfter = (timeMs) => {
const timeoutAfter = (timeMs, setTimeoutSafe, clearTimeoutSafe) => {
let timeoutHandle = null;
const promise = new Promise((resolve) => {
timeoutHandle = setTimeout(() => {
timeoutHandle = setTimeoutSafe(() => {
resolve({

@@ -13,3 +13,3 @@ error: new Error(`Property timeout: exceeded limit of ${timeMs} milliseconds`),

return {
clear: () => clearTimeout(timeoutHandle),
clear: () => clearTimeoutSafe(timeoutHandle),
promise,

@@ -19,5 +19,7 @@ };

export class TimeoutProperty {
constructor(property, timeMs) {
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) {

@@ -38,3 +40,3 @@ this.runBeforeEach = () => Promise.resolve(this.property.runBeforeEach());

async run(v, dontRunHook) {
const t = timeoutAfter(this.timeMs);
const t = timeoutAfter(this.timeMs, this.setTimeoutSafe, this.clearTimeoutSafe);
const propRun = Promise.race([this.property.run(v, dontRunHook), t.promise]);

@@ -41,0 +43,0 @@ propRun.then(t.clear, t.clear);

@@ -6,6 +6,8 @@ import { SkipAfterProperty } from '../property/SkipAfterProperty.js';

const safeDateNow = Date.now;
const safeSetTimeout = setTimeout;
const safeClearTimeout = clearTimeout;
export function decorateProperty(rawProperty, qParams) {
let prop = rawProperty;
if (rawProperty.isAsync() && qParams.timeout != null) {
prop = new TimeoutProperty(prop, qParams.timeout);
prop = new TimeoutProperty(prop, qParams.timeout, safeSetTimeout, safeClearTimeout);
}

@@ -16,6 +18,6 @@ if (qParams.unbiased) {

if (qParams.skipAllAfterTimeLimit != null) {
prop = new SkipAfterProperty(prop, safeDateNow, qParams.skipAllAfterTimeLimit, false);
prop = new SkipAfterProperty(prop, safeDateNow, qParams.skipAllAfterTimeLimit, false, safeSetTimeout, safeClearTimeout);
}
if (qParams.interruptAfterTimeLimit != null) {
prop = new SkipAfterProperty(prop, safeDateNow, qParams.interruptAfterTimeLimit, true);
prop = new SkipAfterProperty(prop, safeDateNow, qParams.interruptAfterTimeLimit, true, safeSetTimeout, safeClearTimeout);
}

@@ -22,0 +24,0 @@ if (qParams.skipEqualValues) {

@@ -104,4 +104,4 @@ import { pre } from './check/precondition/Pre.js';

const __type = 'module';
const __version = '3.5.0';
const __commitHash = 'ec6eb9bc9aa50e1d12ca7f34b57db049cc6fc85f';
const __version = '3.5.1';
const __commitHash = 'd59def83cff86671b80f9f1ff4886e10b98fc1bc';
export { __type, __version, __commitHash, sample, statistics, check, assert, pre, PreconditionFailure, property, asyncProperty, boolean, falsy, float, double, integer, nat, maxSafeInteger, maxSafeNat, bigIntN, bigUintN, bigInt, bigUint, char, ascii, char16bits, unicode, fullUnicode, hexa, base64, mixedCase, string, asciiString, string16bits, stringOf, unicodeString, fullUnicodeString, hexaString, base64String, lorem, constant, constantFrom, mapToConstant, option, oneof, clone, shuffledSubarray, subarray, array, sparseArray, infiniteStream, uniqueArray, tuple, record, dictionary, anything, object, json, jsonValue, unicodeJson, unicodeJsonValue, letrec, memo, compareBooleanFunc, compareFunc, func, context, date, ipV4, ipV4Extended, ipV6, domain, webAuthority, webSegment, webFragments, webPath, webQueryParameters, webUrl, emailAddress, uuid, uuidV, int8Array, uint8Array, uint8ClampedArray, int16Array, uint16Array, int32Array, uint32Array, float32Array, float64Array, bigInt64Array, bigUint64Array, asyncModelRun, modelRun, scheduledModelRun, commands, scheduler, schedulerFor, Arbitrary, Value, cloneMethod, cloneIfNeeded, hasCloneMethod, toStringMethod, hasToStringMethod, asyncToStringMethod, hasAsyncToStringMethod, getDepthContextFor, stringify, asyncStringify, defaultReportMessage, asyncDefaultReportMessage, hash, VerbosityLevel, configureGlobal, readConfigureGlobal, resetConfigureGlobal, ExecutionStatus, Random, Stream, stream, createDepthIdentifier, };

@@ -229,5 +229,5 @@ "use strict";

exports.__type = __type;
const __version = '3.5.0';
const __version = '3.5.1';
exports.__version = __version;
const __commitHash = 'ec6eb9bc9aa50e1d12ca7f34b57db049cc6fc85f';
const __commitHash = 'd59def83cff86671b80f9f1ff4886e10b98fc1bc';
exports.__commitHash = __commitHash;

@@ -120,3 +120,3 @@ import { pre } from './check/precondition/Pre';

/**
* Version of fast-check used by your project (eg.: 3.5.0)
* Version of fast-check used by your project (eg.: 3.5.1)
* @remarks Since 1.22.0

@@ -127,3 +127,3 @@ * @public

/**
* Commit hash of the current code (eg.: ec6eb9bc9aa50e1d12ca7f34b57db049cc6fc85f)
* Commit hash of the current code (eg.: d59def83cff86671b80f9f1ff4886e10b98fc1bc)
* @remarks Since 2.7.0

@@ -130,0 +130,0 @@ * @public

{
"name": "fast-check",
"version": "3.5.0",
"version": "3.5.1",
"description": "Property based testing framework for JavaScript (like QuickCheck)",

@@ -5,0 +5,0 @@ "type": "commonjs",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc