fast-check
Advanced tools
Comparing version 3.6.3 to 3.7.0
@@ -0,1 +1,16 @@ | ||
# 3.7.0 | ||
_Better error reports without duplicated messages_ | ||
[[Code](https://github.com/dubzzz/fast-check/tree/v3.7.0)][[Diff](https://github.com/dubzzz/fast-check/compare/v3.6.3...v3.7.0)] | ||
## Features | ||
- ([PR#3638](https://github.com/dubzzz/fast-check/pull/3638)) Stop repeating the error twice in reports | ||
## Fixes | ||
- ([PR#3637](https://github.com/dubzzz/fast-check/pull/3637)) CI: Update ts-jest configuration files | ||
--- | ||
# 3.6.3 | ||
@@ -2,0 +17,0 @@ |
@@ -54,3 +54,3 @@ "use strict"; | ||
error: new globals_1.Error('Property failed by returning false'), | ||
errorMessage: 'Property failed by returning false', | ||
errorMessage: 'Error: Property failed by returning false', | ||
}; | ||
@@ -62,3 +62,3 @@ } | ||
if (err instanceof globals_1.Error && err.stack) { | ||
return { error: err, errorMessage: `${err}\n\nStack trace: ${err.stack}` }; | ||
return { error: err, errorMessage: err.stack }; | ||
} | ||
@@ -65,0 +65,0 @@ return { error: err, errorMessage: (0, globals_1.String)(err) }; |
@@ -54,3 +54,3 @@ "use strict"; | ||
error: new globals_1.Error('Property failed by returning false'), | ||
errorMessage: 'Property failed by returning false', | ||
errorMessage: 'Error: Property failed by returning false', | ||
}; | ||
@@ -62,3 +62,3 @@ } | ||
if (err instanceof globals_1.Error && err.stack) { | ||
return { error: err, errorMessage: `${err}\n\nStack trace: ${err.stack}` }; | ||
return { error: err, errorMessage: err.stack }; | ||
} | ||
@@ -65,0 +65,0 @@ return { error: err, errorMessage: (0, globals_1.String)(err) }; |
@@ -58,3 +58,3 @@ "use strict"; | ||
const noErrorInMessage = out.runConfiguration.errorWithCause; | ||
const messageErrorPart = noErrorInMessage ? '' : `\nGot error: ${out.error}`; | ||
const messageErrorPart = noErrorInMessage ? '' : `\nGot ${(0, globals_1.safeReplace)(out.error, /^Error: /, 'error: ')}`; | ||
const message = `Property failed after ${out.numRuns} tests\n{ seed: ${out.seed}, path: "${out.counterexamplePath}", endOnFailure: true }\nCounterexample: ${stringifyOne(out.counterexample)}\nShrunk ${out.numShrinks} time(s)${messageErrorPart}`; | ||
@@ -61,0 +61,0 @@ let details = null; |
@@ -51,3 +51,3 @@ import { PreconditionFailure } from '../precondition/PreconditionFailure.js'; | ||
error: new Error('Property failed by returning false'), | ||
errorMessage: 'Property failed by returning false', | ||
errorMessage: 'Error: Property failed by returning false', | ||
}; | ||
@@ -59,3 +59,3 @@ } | ||
if (err instanceof Error && err.stack) { | ||
return { error: err, errorMessage: `${err}\n\nStack trace: ${err.stack}` }; | ||
return { error: err, errorMessage: err.stack }; | ||
} | ||
@@ -62,0 +62,0 @@ return { error: err, errorMessage: String(err) }; |
@@ -51,3 +51,3 @@ import { PreconditionFailure } from '../precondition/PreconditionFailure.js'; | ||
error: new Error('Property failed by returning false'), | ||
errorMessage: 'Property failed by returning false', | ||
errorMessage: 'Error: Property failed by returning false', | ||
}; | ||
@@ -59,3 +59,3 @@ } | ||
if (err instanceof Error && err.stack) { | ||
return { error: err, errorMessage: `${err}\n\nStack trace: ${err.stack}` }; | ||
return { error: err, errorMessage: err.stack }; | ||
} | ||
@@ -62,0 +62,0 @@ return { error: err, errorMessage: String(err) }; |
@@ -1,2 +0,2 @@ | ||
import { Error, safePush } from '../../../utils/globals.js'; | ||
import { Error, safePush, safeReplace } from '../../../utils/globals.js'; | ||
import { stringify, possiblyAsyncStringify } from '../../../utils/stringify.js'; | ||
@@ -55,3 +55,3 @@ import { VerbosityLevel } from '../configuration/VerbosityLevel.js'; | ||
const noErrorInMessage = out.runConfiguration.errorWithCause; | ||
const messageErrorPart = noErrorInMessage ? '' : `\nGot error: ${out.error}`; | ||
const messageErrorPart = noErrorInMessage ? '' : `\nGot ${safeReplace(out.error, /^Error: /, 'error: ')}`; | ||
const message = `Property failed after ${out.numRuns} tests\n{ seed: ${out.seed}, path: "${out.counterexamplePath}", endOnFailure: true }\nCounterexample: ${stringifyOne(out.counterexample)}\nShrunk ${out.numShrinks} time(s)${messageErrorPart}`; | ||
@@ -58,0 +58,0 @@ let details = null; |
@@ -104,4 +104,4 @@ import { pre } from './check/precondition/Pre.js'; | ||
const __type = 'module'; | ||
const __version = '3.6.3'; | ||
const __commitHash = '58b8809067d7aadebbecee5ba4823653667d5a87'; | ||
const __version = '3.7.0'; | ||
const __commitHash = 'fd64d84cba16008540e8bc2b6311bbf85f674f93'; | ||
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, }; |
@@ -245,2 +245,3 @@ import { safeApply } from './apply.js'; | ||
const untouchedCharCodeAt = String.prototype.charCodeAt; | ||
const untouchedReplace = String.prototype.replace; | ||
function extractSplit(instance) { | ||
@@ -310,2 +311,10 @@ try { | ||
} | ||
function extractReplace(instance) { | ||
try { | ||
return instance.replace; | ||
} | ||
catch (err) { | ||
return undefined; | ||
} | ||
} | ||
export function safeSplit(instance, ...args) { | ||
@@ -359,2 +368,8 @@ if (extractSplit(instance) === untouchedSplit) { | ||
} | ||
export function safeReplace(instance, pattern, replacement) { | ||
if (extractReplace(instance) === untouchedReplace) { | ||
return instance.replace(pattern, replacement); | ||
} | ||
return safeApply(untouchedReplace, instance, [pattern, replacement]); | ||
} | ||
const untouchedNumberToString = Number.prototype.toString; | ||
@@ -361,0 +376,0 @@ function extractNumberToString(instance) { |
@@ -229,5 +229,5 @@ "use strict"; | ||
exports.__type = __type; | ||
const __version = '3.6.3'; | ||
const __version = '3.7.0'; | ||
exports.__version = __version; | ||
const __commitHash = '58b8809067d7aadebbecee5ba4823653667d5a87'; | ||
const __commitHash = 'fd64d84cba16008540e8bc2b6311bbf85f674f93'; | ||
exports.__commitHash = __commitHash; |
@@ -120,3 +120,3 @@ import { pre } from './check/precondition/Pre'; | ||
/** | ||
* Version of fast-check used by your project (eg.: 3.6.3) | ||
* Version of fast-check used by your project (eg.: 3.7.0) | ||
* @remarks Since 1.22.0 | ||
@@ -127,3 +127,3 @@ * @public | ||
/** | ||
* Commit hash of the current code (eg.: 58b8809067d7aadebbecee5ba4823653667d5a87) | ||
* Commit hash of the current code (eg.: fd64d84cba16008540e8bc2b6311bbf85f674f93) | ||
* @remarks Since 2.7.0 | ||
@@ -130,0 +130,0 @@ * @public |
@@ -62,4 +62,5 @@ declare const SArray: typeof Array; | ||
export declare function safeCharCodeAt(instance: string, index: number): number; | ||
export declare function safeReplace(instance: string, pattern: RegExp | string, replacement: string): string; | ||
export declare function safeNumberToString(instance: number, ...args: [radix?: number | undefined]): string; | ||
export declare function safeHasOwnProperty(instance: unknown, v: PropertyKey): boolean; | ||
export declare function safeToString(instance: unknown): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.safeToString = exports.safeHasOwnProperty = exports.safeNumberToString = exports.safeCharCodeAt = exports.safePadStart = exports.safeToUpperCase = exports.safeToLowerCase = exports.safeSubstring = exports.safeEndsWith = exports.safeStartsWith = exports.safeSplit = exports.safeAdd = exports.safeToISOString = exports.safeGetTime = exports.safeSort = exports.safeSlice = exports.safeSplice = exports.safePop = exports.safePush = exports.safeFilter = exports.safeMap = exports.safeJoin = exports.safeIndexOf = exports.safeForEach = exports.encodeURIComponent = exports.Uint32Array = exports.Uint16Array = exports.Uint8ClampedArray = exports.Uint8Array = exports.Set = exports.String = exports.Number = exports.Int32Array = exports.Int16Array = exports.Int8Array = exports.Float64Array = exports.Float32Array = exports.Error = exports.Date = exports.Boolean = exports.BigUint64Array = exports.BigInt64Array = exports.BigInt = exports.Array = void 0; | ||
exports.safeToString = exports.safeHasOwnProperty = exports.safeNumberToString = exports.safeReplace = exports.safeCharCodeAt = exports.safePadStart = exports.safeToUpperCase = exports.safeToLowerCase = exports.safeSubstring = exports.safeEndsWith = exports.safeStartsWith = exports.safeSplit = exports.safeAdd = exports.safeToISOString = exports.safeGetTime = exports.safeSort = exports.safeSlice = exports.safeSplice = exports.safePop = exports.safePush = exports.safeFilter = exports.safeMap = exports.safeJoin = exports.safeIndexOf = exports.safeForEach = exports.encodeURIComponent = exports.Uint32Array = exports.Uint16Array = exports.Uint8ClampedArray = exports.Uint8Array = exports.Set = exports.String = exports.Number = exports.Int32Array = exports.Int16Array = exports.Int8Array = exports.Float64Array = exports.Float32Array = exports.Error = exports.Date = exports.Boolean = exports.BigUint64Array = exports.BigInt64Array = exports.BigInt = exports.Array = void 0; | ||
const apply_1 = require("./apply"); | ||
@@ -261,2 +261,3 @@ const SArray = typeof Array !== 'undefined' ? Array : undefined; | ||
const untouchedCharCodeAt = String.prototype.charCodeAt; | ||
const untouchedReplace = String.prototype.replace; | ||
function extractSplit(instance) { | ||
@@ -326,2 +327,10 @@ try { | ||
} | ||
function extractReplace(instance) { | ||
try { | ||
return instance.replace; | ||
} | ||
catch (err) { | ||
return undefined; | ||
} | ||
} | ||
function safeSplit(instance, ...args) { | ||
@@ -383,2 +392,9 @@ if (extractSplit(instance) === untouchedSplit) { | ||
exports.safeCharCodeAt = safeCharCodeAt; | ||
function safeReplace(instance, pattern, replacement) { | ||
if (extractReplace(instance) === untouchedReplace) { | ||
return instance.replace(pattern, replacement); | ||
} | ||
return (0, apply_1.safeApply)(untouchedReplace, instance, [pattern, replacement]); | ||
} | ||
exports.safeReplace = safeReplace; | ||
const untouchedNumberToString = Number.prototype.toString; | ||
@@ -385,0 +401,0 @@ function extractNumberToString(instance) { |
{ | ||
"name": "fast-check", | ||
"version": "3.6.3", | ||
"version": "3.7.0", | ||
"description": "Property based testing framework for JavaScript (like QuickCheck)", | ||
@@ -60,11 +60,11 @@ "type": "commonjs", | ||
"@fast-check/poisoning": "0.0.5", | ||
"@microsoft/api-extractor": "^7.34.3", | ||
"@microsoft/api-extractor": "^7.34.4", | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "^18.13.0", | ||
"@types/node": "^18.14.1", | ||
"buffer": "^6.0.3", | ||
"cross-env": "^7.0.3", | ||
"jest": "^29.4.2", | ||
"jest": "^29.4.3", | ||
"replace-in-file": "^6.3.5", | ||
"ts-jest": "^29.0.5", | ||
"typedoc": "^0.23.24", | ||
"typedoc": "^0.23.25", | ||
"typescript": "^4.9.5" | ||
@@ -71,0 +71,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
886804
19966