Best JavaScript code snippet using fast-check-monorepo
Runner.spec.ts
Source:Runner.spec.ts
1import * as fc from 'fast-check';2import { Value } from '../../../../src/check/arbitrary/definition/Value';3import { char } from '../../../../src/arbitrary/char';4import { IRawProperty } from '../../../../src/check/property/IRawProperty';5import { check, assert as rAssert } from '../../../../src/check/runner/Runner';6import { Random } from '../../../../src/random/generator/Random';7import { RunDetails } from '../../../../src/check/runner/reporter/RunDetails';8import { PreconditionFailure } from '../../../../src/check/precondition/PreconditionFailure';9import { Stream } from '../../../../src/stream/Stream';10import { VerbosityLevel } from '../../../../src/check/runner/configuration/VerbosityLevel';11const MAX_NUM_RUNS = 1000;12describe('Runner', () => {13 describe('check', () => {14 it('Should throw if property is null', () => {15 expect(() => check(null as any as IRawProperty<unknown>)).toThrowError();16 });17 it('Should throw if property is not a property at all', () => {18 expect(() => check({} as IRawProperty<unknown>)).toThrowError();19 });20 it('Should throw if property is an Arbitrary', () => {21 expect(() => check(char() as any as IRawProperty<unknown>)).toThrowError();22 });23 it.each`24 isAsync25 ${false}26 ${true}27 `('Should throw if both reporter and asyncReporter are defined (isAsync: $isAsync)', ({ isAsync }) => {28 const p: IRawProperty<[number]> = {29 isAsync: () => isAsync,30 generate: () => new Value([0], undefined),31 shrink: () => Stream.nil(),32 run: () => null,33 };34 expect(() => check(p, { reporter: () => {}, asyncReporter: async () => {} })).toThrowError();35 });36 it('Should not throw if reporter is specified on synchronous properties', () => {37 const p: IRawProperty<[number]> = {38 isAsync: () => false,39 generate: () => new Value([0], undefined),40 shrink: () => Stream.nil(),41 run: () => null,42 };43 expect(() => check(p, { reporter: () => {} })).not.toThrowError();44 });45 it('Should not throw if reporter is specified on asynchronous properties', () => {46 const p: IRawProperty<[number]> = {47 isAsync: () => true,48 generate: () => new Value([0], undefined),49 shrink: () => Stream.nil(),50 run: () => null,51 };52 expect(() => check(p, { reporter: () => {} })).not.toThrowError();53 });54 it('Should throw if asyncReporter is specified on synchronous properties', () => {55 const p: IRawProperty<[number]> = {56 isAsync: () => false,57 generate: () => new Value([0], undefined),58 shrink: () => Stream.nil(),59 run: () => null,60 };61 expect(() => check(p, { asyncReporter: async () => {} })).toThrowError();62 });63 it('Should not throw if asyncReporter is specified on asynchronous properties', () => {64 const p: IRawProperty<[number]> = {65 isAsync: () => true,66 generate: () => new Value([0], undefined),67 shrink: () => Stream.nil(),68 run: () => null,69 };70 expect(() => check(p, { asyncReporter: async () => {} })).not.toThrowError();71 });72 it('Should call the property 100 times by default (on success)', () => {73 let numCallsGenerate = 0;74 let numCallsRun = 0;75 const p: IRawProperty<[number]> = {76 isAsync: () => false,77 generate: () => {78 expect(numCallsRun).toEqual(numCallsGenerate); // called run before calling back79 ++numCallsGenerate;80 return new Value([numCallsGenerate] as [number], undefined);81 },82 shrink: () => Stream.nil(),83 run: (value: [number]) => {84 expect(value[0]).toEqual(numCallsGenerate); // called with previously generated value85 ++numCallsRun;86 return null;87 },88 };89 const out = check(p) as RunDetails<[number]>;90 expect(numCallsGenerate).toEqual(100);91 expect(numCallsRun).toEqual(100);92 expect(out.failed).toBe(false);93 });94 it('Should call the property 100 times even when path provided (on success)', () => {95 let numCallsGenerate = 0;96 let numCallsRun = 0;97 const p: IRawProperty<[number]> = {98 isAsync: () => false,99 generate: () => {100 expect(numCallsRun).toEqual(numCallsGenerate); // called run before calling back101 ++numCallsGenerate;102 return new Value([numCallsGenerate] as [number], undefined);103 },104 shrink: () => Stream.nil(),105 run: (value: [number]) => {106 expect(value[0]).toEqual(numCallsGenerate); // called with previously generated value107 ++numCallsRun;108 return null;109 },110 };111 const out = check(p, { path: '3002' }) as RunDetails<[number]>;112 expect(numCallsGenerate).toEqual(100);113 expect(numCallsRun).toEqual(100);114 expect(out.failed).toBe(false);115 });116 it('Should call the property on all shrunk values for path (on success)', () => {117 let numCallsGenerate = 0;118 let numCallsRun = 0;119 const p: IRawProperty<[number]> = {120 isAsync: () => false,121 generate: () => {122 ++numCallsGenerate;123 return new Value<[number]>([0], 'shrink-me');124 },125 shrink: (value) => {126 function* g() {127 if (value.context !== 'shrink-me') {128 return;129 }130 for (let i = 0; i !== 1234; ++i) {131 yield new Value<[number]>([0], undefined);132 }133 }134 return new Stream(g());135 },136 run: () => {137 ++numCallsRun;138 return null;139 },140 };141 const out = check(p, { path: '3002:0' }) as RunDetails<[number]>;142 expect(numCallsGenerate).toEqual(1);143 expect(numCallsRun).toEqual(1234);144 expect(out.failed).toBe(false);145 });146 it('Should ignore precondition failure runs and generate another value', async () => {147 const gapsBetweenSuccessesArb = fc.array(fc.nat(10), { minLength: 100, maxLength: 100 });148 const successfulRunIdsArb = gapsBetweenSuccessesArb.map((gaps) =>149 gaps.reduce((prev: number[], cur: number) => {150 prev.push(prev.length === 0 ? cur : prev[prev.length - 1] + cur + 1);151 return prev;152 }, [])153 );154 await fc.assert(155 fc.asyncProperty(156 successfulRunIdsArb,157 fc.boolean(),158 fc.option(fc.nat(99)),159 async (successIds, isAsyncProp, failAtId) => {160 let numCallsGenerate = 0;161 let numCallsRun = 0;162 const p: IRawProperty<[number]> = {163 isAsync: () => isAsyncProp,164 generate: () => new Value([numCallsGenerate++] as [number], undefined),165 shrink: () => Stream.nil(),166 run: (value: [number]) => {167 ++numCallsRun;168 const successId = successIds.indexOf(value[0]);169 if (successId !== -1)170 return successId === failAtId ? { error: new Error(), errorMessage: 'failed' } : null;171 return new PreconditionFailure();172 },173 };174 const out = await check(p);175 if (failAtId == null) {176 const expectedGenerate = successIds[successIds.length - 1] + 1;177 const expectedSkips = expectedGenerate - 100;178 expect(numCallsGenerate).toEqual(expectedGenerate);179 expect(numCallsRun).toEqual(expectedGenerate);180 expect(out.numRuns).toEqual(100);181 expect(out.numSkips).toEqual(expectedSkips);182 expect(out.failed).toBe(false);183 } else {184 const expectedGenerate = successIds[failAtId] + 1;185 const expectedSkips = expectedGenerate - failAtId - 1;186 expect(numCallsGenerate).toEqual(expectedGenerate);187 expect(numCallsRun).toEqual(expectedGenerate);188 expect(out.numRuns).toEqual(failAtId + 1);189 expect(out.numSkips).toEqual(expectedSkips);190 expect(out.failed).toBe(true);191 }192 }193 )194 );195 });196 it('Should fail on too many precondition failures', async () => {197 await fc.assert(198 fc.asyncProperty(199 fc.nat(1000).chain((v) => fc.record({ maxSkipsPerRun: fc.constant(v), onlySuccessId: fc.nat(2 * v + 1) })),200 fc.boolean(),201 async (settings, isAsyncProp) => {202 let numCallsGenerate = 0;203 let numPreconditionFailures = 0;204 const p: IRawProperty<[number]> = {205 isAsync: () => isAsyncProp,206 generate: () => new Value([numCallsGenerate++] as [number], undefined),207 shrink: () => Stream.nil(),208 run: (value: [number]) => {209 if (value[0] === settings.onlySuccessId) return null;210 ++numPreconditionFailures;211 return new PreconditionFailure();212 },213 };214 const out = await check(p, { numRuns: 2, maxSkipsPerRun: settings.maxSkipsPerRun });215 const expectedSkips = 2 * settings.maxSkipsPerRun + 1;216 const expectedRuns = settings.onlySuccessId === expectedSkips ? 0 : 1;217 expect(out.numRuns).toEqual(expectedRuns);218 expect(numPreconditionFailures).toEqual(expectedSkips);219 expect(out.numSkips).toEqual(expectedSkips);220 expect(out.failed).toBe(true);221 }222 )223 );224 });225 it('Should never call shrink on success', () => {226 let numCallsGenerate = 0;227 let numCallsRun = 0;228 const p: IRawProperty<[number]> = {229 isAsync: () => false,230 generate: () => {231 ++numCallsGenerate;232 return new Value([0], undefined);233 },234 shrink: () => {235 throw 'Not implemented';236 },237 run: (_value: [number]) => {238 ++numCallsRun;239 return null;240 },241 };242 const out = check(p) as RunDetails<[number]>;243 expect(numCallsGenerate).toEqual(100);244 expect(numCallsRun).toEqual(100);245 expect(out.failed).toBe(false);246 });247 it('Should call the property 100 times by default (except on error)', () =>248 fc.assert(249 fc.property(fc.integer({ min: 1, max: 100 }), fc.integer(), (num, seed) => {250 let numCallsGenerate = 0;251 let numCallsRun = 0;252 const p: IRawProperty<[number]> = {253 isAsync: () => false,254 generate: () => {255 ++numCallsGenerate;256 return new Value([0], undefined);257 },258 shrink: () => Stream.nil(),259 run: (_value: [number]) => {260 return ++numCallsRun < num ? null : { error: new Error(), errorMessage: 'error' };261 },262 };263 const out = check(p, { seed: seed }) as RunDetails<[number]>;264 expect(numCallsGenerate).toEqual(num); // stopped generate at first failing run265 expect(numCallsRun).toEqual(num); // no shrink for first failing run266 expect(out.failed).toBe(true);267 expect(out.numRuns).toEqual(num);268 expect(out.seed).toEqual(seed);269 return true;270 })271 ));272 it('Should alter the number of runs when asked to', () =>273 fc.assert(274 fc.property(fc.nat(MAX_NUM_RUNS), (num) => {275 let numCallsGenerate = 0;276 let numCallsRun = 0;277 const p: IRawProperty<[number]> = {278 isAsync: () => false,279 generate: () => {280 ++numCallsGenerate;281 return new Value([0], undefined);282 },283 shrink: () => Stream.nil(),284 run: (_value: [number]) => {285 ++numCallsRun;286 return null;287 },288 };289 const out = check(p, { numRuns: num }) as RunDetails<[number]>;290 expect(numCallsGenerate).toEqual(num);291 expect(numCallsRun).toEqual(num);292 expect(out.failed).toBe(false);293 return true;294 })295 ));296 it('Should generate the same values given the same seeds', () =>297 fc.assert(298 fc.property(fc.integer(), (seed) => {299 const buildPropertyFor = function (runOn: number[]) {300 const p: IRawProperty<[number]> = {301 isAsync: () => false,302 generate: (rng: Random) => {303 return new Value([rng.nextInt()], undefined);304 },305 shrink: () => Stream.nil(),306 run: (value: [number]) => {307 runOn.push(value[0]);308 return null;309 },310 };311 return p;312 };313 const data1: number[] = [];314 const data2: number[] = [];315 check(buildPropertyFor(data1), { seed: seed });316 check(buildPropertyFor(data2), { seed: seed });317 expect(data2).toEqual(data1);318 return true;319 })320 ));321 it('Should never call shrink if endOnFailure', () => {322 const p: IRawProperty<[number]> = {323 isAsync: () => false,324 generate: () => {325 return new Value([0], undefined);326 },327 shrink: () => {328 throw 'Not implemented';329 },330 run: (_value: [number]) => {331 return { error: new Error(), errorMessage: 'failure' };332 },333 };334 const out = check(p, { endOnFailure: true }) as RunDetails<[number]>;335 expect(out.failed).toBe(true);336 expect(out.numShrinks).toEqual(0);337 });338 it('Should compute values for path before removing shrink if endOnFailure', () => {339 const p: IRawProperty<[number]> = {340 isAsync: () => false,341 generate: () => {342 return new Value([0], undefined);343 },344 shrink: (value) => {345 if (value.value[0] !== 0) {346 throw 'Not implemented';347 }348 return Stream.of(new Value([42], undefined));349 },350 run: (value: [number]) => {351 return value[0] === 42 ? { error: new Error(), errorMessage: 'failure' } : null;352 },353 };354 const out = check(p, { path: '0:0', endOnFailure: true }) as RunDetails<[number]>;355 expect(out.failed).toBe(true);356 expect(out.numShrinks).toEqual(0);357 });358 it('Should not provide list of failures by default (no verbose)', () => {359 const p: IRawProperty<[number]> = {360 isAsync: () => false,361 generate: () => new Value([42], undefined),362 shrink: () => Stream.nil(),363 run: () => ({ error: new Error(), errorMessage: 'failure' }),364 };365 const out = check(p) as RunDetails<[number]>;366 expect(out.failures).toHaveLength(0);367 });368 it('Should provide the list of failures in verbose mode', () => {369 const p: IRawProperty<[number]> = {370 isAsync: () => false,371 generate: () => new Value([42], undefined),372 shrink: (value) => {373 return value.value[0] === 42374 ? Stream.of(new Value([48], undefined), new Value([12], undefined))375 : Stream.nil();376 },377 run: () => ({ error: new Error(), errorMessage: 'failure' }),378 };379 const out = check(p, { verbose: true }) as RunDetails<[number]>;380 expect(out.failures).not.toHaveLength(0);381 expect(out.failures).toEqual([[42], [48]]);382 });383 it('Should build the right counterexamplePath', () =>384 fc.assert(385 fc.property(fc.integer(), fc.array(fc.nat(99), { minLength: 1, maxLength: 100 }), (seed, failurePoints) => {386 // Each entry (at index idx) in failurePoints represents the number of runs387 // required before failing for the level <idx>388 // Basically it must fail before the end of the execution (100 runs by default)389 // so failure points are between 0 and 99 inclusive390 let idx = 0;391 let remainingBeforeFailure = failurePoints[idx];392 const p: IRawProperty<[number]> = {393 isAsync: () => false,394 generate: (_mrng: Random) => new Value([0], failurePoints.length - 1),395 shrink: (value) => {396 const depth = value.context as number;397 if (depth <= 0) {398 return Stream.nil();399 }400 function* g(): IterableIterator<Value<[number]>> {401 while (true) yield new Value([0], depth - 1);402 }403 return new Stream(g());404 },405 run: (_value: [number]) => {406 if (--remainingBeforeFailure >= 0) return null;407 remainingBeforeFailure = failurePoints[++idx];408 return { error: new Error(), errorMessage: 'failure' };409 },410 };411 const expectedFailurePath = failurePoints.join(':');412 const out = check(p, { seed: seed }) as RunDetails<[number]>;413 expect(out.failed).toBe(true);414 expect(out.seed).toEqual(seed);415 expect(out.numRuns).toEqual(failurePoints[0] + 1);416 expect(out.numShrinks).toEqual(failurePoints.length - 1);417 expect(out.counterexamplePath).toEqual(expectedFailurePath);418 })419 ));420 it('Should wait on async properties to complete', async () =>421 fc.assert(422 fc.asyncProperty(fc.integer({ min: 1, max: 100 }), fc.integer(), async (num, seed) => {423 const delay = () => new Promise((resolve) => setTimeout(resolve, 0));424 let runnerHasCompleted = false;425 const waitingResolve: (() => void)[] = [];426 let numCallsGenerate = 0;427 let numCallsRun = 0;428 const p: IRawProperty<[number]> = {429 isAsync: () => true,430 generate: () => {431 ++numCallsGenerate;432 return new Value([1], undefined);433 },434 shrink: (value) => {435 return value.value[0] === 1 ? Stream.of(new Value([42], undefined)) : Stream.nil();436 },437 run: async (_value: [number]) => {438 await new Promise<void>((resolve) => {439 waitingResolve.push(resolve);440 });441 return ++numCallsRun < num ? null : { error: new Error(), errorMessage: 'error' };442 },443 };444 const checker = check(p, { seed: seed }) as Promise<RunDetails<[number]>>;445 checker.then(() => (runnerHasCompleted = true));446 await delay();447 while (waitingResolve.length > 0) {448 expect(waitingResolve).toHaveLength(1); // no multiple properties in parallel449 expect(runnerHasCompleted).toBe(false); // not completed yet450 waitingResolve.shift()!();451 await delay();452 }453 await delay();454 expect(runnerHasCompleted).toBe(true);455 const out = await checker;456 expect(numCallsGenerate).toEqual(num); // stopped generate at first failing run457 expect(numCallsRun).toEqual(num + 1); // stopped run one shrink after first failing run458 expect(out.failed).toBe(true);459 expect(out.numRuns).toEqual(num);460 expect(out.seed).toEqual(seed);461 expect(out.counterexample).toEqual([42]);462 return true;463 })464 ));465 it('Should not timeout if no timeout defined', async () => {466 const p: IRawProperty<[number]> = {467 isAsync: () => true,468 generate: () => new Value([1], undefined),469 shrink: () => Stream.nil(),470 run: async (_value: [number]) => null,471 };472 const out = await (check(p) as Promise<RunDetails<[number]>>);473 expect(out.failed).toBe(false);474 });475 it('Should not timeout if timeout not reached', async () => {476 const wait = (timeMs: number) => new Promise<null>((resolve) => setTimeout(() => resolve(null), timeMs));477 const p: IRawProperty<[number]> = {478 isAsync: () => true,479 generate: () => new Value([1], undefined),480 shrink: () => Stream.nil(),481 run: async (_value: [number]) => await wait(0),482 };483 const out = await (check(p, { timeout: 100 }) as Promise<RunDetails<[number]>>);484 expect(out.failed).toBe(false);485 });486 it('Should timeout if it reached the timeout', async () => {487 const wait = (timeMs: number) => new Promise<null>((resolve) => setTimeout(() => resolve(null), timeMs));488 const p: IRawProperty<[number]> = {489 isAsync: () => true,490 generate: () => new Value([1], undefined),491 shrink: () => Stream.nil(),492 run: async (_value: [number]) => await wait(100),493 };494 const out = await (check(p, { timeout: 0 }) as Promise<RunDetails<[number]>>);495 expect(out.failed).toBe(true);496 });497 it('Should timeout if task never ends', async () => {498 const neverEnds = () => new Promise<null>(() => {});499 const p: IRawProperty<[number]> = {500 isAsync: () => true,501 generate: () => new Value([1], undefined),502 shrink: () => Stream.nil(),503 run: async (_value: [number]) => await neverEnds(),504 };505 const out = await (check(p, { timeout: 0 }) as Promise<RunDetails<[number]>>);506 expect(out.failed).toBe(true);507 });508 });509 describe('assert', () => {510 const v1 = { toString: () => 'toString(value#1)' };511 const v2 = { a: 'Hello', b: 21 };512 const failingProperty: IRawProperty<[any, any]> = {513 isAsync: () => false,514 generate: () => new Value([v1, v2], undefined),515 shrink: () => Stream.nil(),516 run: (_v: [any, any]) => ({ error: new Error(), errorMessage: 'error in failingProperty' }),517 };518 const failingComplexProperty: IRawProperty<[any, any, any]> = {519 isAsync: () => false,520 generate: () => new Value([[v1, v2], v2, v1], undefined),521 shrink: () => Stream.nil(),522 run: (_v: [any, any, any]) => ({ error: new Error(), errorMessage: 'error in failingComplexProperty' }),523 };524 const successProperty: IRawProperty<[any, any]> = {525 isAsync: () => false,526 generate: () => new Value([v1, v2], undefined),527 shrink: () => Stream.nil(),528 run: (_v: [any, any]) => null,529 };530 it('Should throw if property is null', () => {531 expect(() => rAssert(null as any as IRawProperty<unknown>)).toThrowError();532 });533 it('Should throw if property is not a property at all', () => {534 expect(() => rAssert({} as IRawProperty<unknown>)).toThrowError();535 });536 it('Should throw if property is an Arbitrary', () => {537 expect(() => rAssert(char() as any as IRawProperty<unknown>)).toThrowError();538 });539 it('Should never throw if no failure occured', () => {540 expect(() => rAssert(successProperty, { seed: 42 })).not.toThrow();541 });542 it('Should throw on failure', () => {543 expect(() => rAssert(failingProperty, { seed: 42 })).toThrowError();544 });545 it('Should put the seed in error message', () => {546 expect(() => rAssert(failingProperty, { seed: 42 })).toThrowError(`seed: 42, path:`);547 });548 it('Should put the number of tests in error message', () => {549 expect(() => rAssert(failingProperty, { seed: 42 })).toThrowError(`failed after 1 test`);550 });551 it('Should pretty print the failing example in error message', () => {552 expect(() => rAssert(failingProperty, { seed: 42 })).toThrowError(`[${v1.toString()},${JSON.stringify(v2)}]`);553 });554 it('Should pretty print the failing complex example in error message', () => {555 expect(() => rAssert(failingComplexProperty, { seed: 42 })).toThrowError(556 `[[${v1.toString()},${JSON.stringify(v2)}],${JSON.stringify(v2)},${v1.toString()}]`557 );558 });559 it('Should put the orginal error in error message', () => {560 expect(() => rAssert(failingProperty, { seed: 42 })).toThrowError(`Got error: error in failingProperty`);561 });562 describe('Impact of VerbosityLevel in case of failure', () => {563 const baseErrorMessage = '';564 const p: IRawProperty<[number]> = {565 isAsync: () => false,566 generate: () => {567 return new Value([42], undefined);568 },569 shrink: (value) => {570 return value.value[0] === 42571 ? Stream.of(new Value([48], undefined), new Value([12], undefined))572 : Stream.nil();573 },574 run: () => ({ error: new Error(), errorMessage: 'failure' }),575 };576 it('Should throw with base message by default (no verbose)', () => {577 expect(() => rAssert(p)).toThrowError(baseErrorMessage);578 });579 it('Should throw without list of failures by default (no verbose)', () => {580 expect(() => rAssert(p)).not.toThrowError('Encountered failures were:');581 });582 it('Should throw without execution tree by default (no verbose)', () => {583 expect(() => rAssert(p)).not.toThrowError('Execution summary:');584 });585 it('Should throw with base message in verbose mode', () => {586 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).toThrowError(baseErrorMessage);587 });588 it('Should throw with list of failures in verbose mode', () => {589 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).toThrowError('Encountered failures were:');590 });591 it('Should throw without execution tree in verbose mode', () => {592 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).not.toThrowError('Execution summary:');593 });594 it('Should throw with base message in very verbose mode', () => {595 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).toThrowError(baseErrorMessage);596 });597 it('Should throw without list of failures in very verbose mode', () => {598 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).not.toThrowError(599 'Encountered failures were:'600 );601 });602 it('Should throw with execution tree in very verbose mode', () => {603 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).toThrowError('Execution summary:');604 });605 });606 describe('Impact of VerbosityLevel in case of too many skipped runs', () => {607 const baseErrorMessage = 'Failed to run property, too many pre-condition failures encountered';608 const p: IRawProperty<[number]> = {609 isAsync: () => false,610 generate: () => new Value([42], undefined),611 shrink: () => Stream.nil(),612 run: () => new PreconditionFailure(),613 };614 it('Should throw with base message by default (no verbose)', () => {615 expect(() => rAssert(p)).toThrowError(baseErrorMessage);616 });617 it('Should throw without list of failures by default (no verbose)', () => {618 expect(() => rAssert(p)).not.toThrowError('Encountered failures were:');619 });620 it('Should throw without execution tree by default (no verbose)', () => {621 expect(() => rAssert(p)).not.toThrowError('Execution summary:');622 });623 it('Should throw with base message in verbose mode', () => {624 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).toThrowError(baseErrorMessage);625 });626 it('Should throw without list of failures in verbose mode', () => {627 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).not.toThrowError('Encountered failures were:');628 });629 it('Should throw without execution tree in verbose mode', () => {630 expect(() => rAssert(p, { verbose: VerbosityLevel.Verbose })).not.toThrowError('Execution summary:');631 });632 it('Should throw with base message in very verbose mode', () => {633 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).toThrowError(baseErrorMessage);634 });635 it('Should throw without list of failures in very verbose mode', () => {636 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).not.toThrowError(637 'Encountered failures were:'638 );639 });640 it('Should throw with execution tree in very verbose mode', () => {641 expect(() => rAssert(p, { verbose: VerbosityLevel.VeryVerbose })).toThrowError('Execution summary:');642 });643 });644 });...
Using AI Code Generation
1const { successfulRunIdsArb } = require("fast-check-monorepo");2const { successfulRunIdsArb } = require("fast-check-monorepo");3const { successfulRunIdsArb } = require("fast-check-monorepo");4const { successfulRunIdsArb } = require("fast-check-monorepo");5const { successfulRunIdsArb } = require("fast-check-monorepo");6const { successfulRunIdsArb } = require("fast-check-monorepo");7const { successfulRunIdsArb } = require("fast-check-monorepo");8const { successfulRunIdsArb } = require("fast-check-monorepo");9const { successfulRunIdsArb } = require("fast-check-monorepo");10const { successfulRunIdsArb } = require("fast-check-monorepo");11const { successfulRunIdsArb } = require("fast-check-monorepo");12const { successfulRunIdsArb } = require("fast-check-monorepo");13const { successfulRunIdsArb } = require("fast-check-monorepo");14const { successfulRunIdsArb } = require("fast-check-monorepo");15const { successfulRunIdsArb } = require("fast-check-monorepo");
Using AI Code Generation
1const { successfulRunIdsArb } = require('fast-check-monorepo');2const { successfulRunIdsArb } = require('fast-check-monorepo');3const { successfulRunIdsArb } = require('fast-check-monorepo');4const { successfulRunIdsArb } = require('fast-check-monorepo');5const { successfulRunIdsArb } = require('fast-check-monorepo');6const { successfulRunIdsArb } = require('fast-check-monorepo');7const { successfulRunIdsArb } = require('fast-check-monorepo');8const { successfulRunIdsArb } = require('fast-check-monorepo');9const { successfulRunIdsArb } = require('fast-check-monorepo');10const { successfulRunIdsArb } = require('fast-check-monorepo');11const { successfulRunIdsArb } = require('fast-check-monorepo');12const { successfulRunIdsArb } = require('fast-check-monorepo');13const { successfulRunIdsArb } = require('fast-check-monorepo');14const { successfulRunIdsArb } = require('fast-check-monorepo');15const { successfulRunIdsArb } = require('fast-check-monorepo');16const { successfulRunIdsArb } = require('fast-check-monorepo');17const { successfulRunIdsArb } = require('fast-check-monorepo');18const { successfulRunIdsArb } = require('fast-check-monorepo');19const { successfulRunIdsArb } = require('fast-check-monorepo');20const { successfulRunIdsArb } = require('fast-check-monorepo');21const { successfulRunIdsArb }
Using AI Code Generation
1import { successfulRunIdsArb } from 'fast-check-monorepo';2describe('test', () => {3 it('test', () => {4 fc.assert(5 fc.property(successfulRunIdsArb(), (successfulRunIds) => {6 console.log(successfulRunIds);7 })8 );9 });10});11import { successfulRunIdsArb } from 'fast-check-monorepo';12describe('test', () => {13 it('test', () => {14 fc.assert(15 fc.property(successfulRunIdsArb(), (successfulRunIds) => {16 console.log(successfulRunIds);17 })18 );19 });20});21import { successfulRunIdsArb } from 'fast-check-monorepo';22describe('test', () => {23 it('test', () => {24 fc.assert(25 fc.property(successfulRunIdsArb(), (successfulRunIds) => {26 console.log(successfulRunIds);27 })28 );29 });30});31import { successfulRunIdsArb } from 'fast-check-monorepo';32describe('test', () => {33 it('test', () => {34 fc.assert(35 fc.property(successfulRunIdsArb(), (successfulRunIds) => {36 console.log(successfulRunIds);37 })38 );39 });40});41import { successfulRunIdsArb } from 'fast-check-monorepo';42describe('test', () => {43 it('test', () => {44 fc.assert(45 fc.property(successfulRunIdsArb(), (successfulRunIds) => {46 console.log(successfulRunIds);47 })48 );49 });50});51import { successfulRunIdsArb } from 'fast-check-monorepo';52describe('test', () => {53 it('test', () => {54 fc.assert(55 fc.property(successfulRunIdsAr
Using AI Code Generation
1const { successfulRunIdsArb } = require('fast-check-monorepo');2describe('my test', () => {3 it('should do something', () => {4 fc.assert(5 fc.property(successfulRunIdsArb(), (runIds) => {6 })7 );8 });9});10{11 "scripts": {12 },13 "devDependencies": {14 }15}
Using AI Code Generation
1const { successfulRunIdsArb } = require('fast-check-monorepo');2const fc = require('fast-check');3const runIdsArb = successfulRunIdsArb(100);4fc.assert(fc.property(runIdsArb, (runIds) => {5 return runIds.length > 0;6}));7{8 "scripts": {9 },10 "dependencies": {11 }12}13npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!