question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sampling a property throws an error inside fast-check: "this.arb.withBias is not a function"

See original GitHub issue

🐛 Bug Report

I want to be able to change the assert function to a sample and see what values might be input into my test.

However, when I sample a property, I get the following error:

    TypeError: this.arb.withBias is not a function

      45 |
      46 | test('reproduction', () => {
    > 47 |   fc.sample(fc.property(fc.integer(), () => {})).forEach(console.log)
         |      ^
      48 | })
      49 |

      at ConverterToNext.generate (node_modules/fast-check/lib/check/arbitrary/definition/ConverterToNext.js:33:55)
      at Property.generate (node_modules/fast-check/lib/check/property/Property.generic.js:28:32)
      at node_modules/fast-check/lib/check/runner/Tosser.js:9:28
      at node_modules/fast-check/lib/check/runner/Sampler.js:26:62
      at mapHelper (node_modules/fast-check/lib/stream/StreamHelpers.js:19:15)
          at mapHelper.next (<anonymous>)
      at Object.sample (node_modules/fast-check/lib/check/runner/Sampler.js:33:16)
      at Object.<anonymous> (test/connectDisconnectModel.test.ts:47:6)

To Reproduce

fc.sample(fc.property(fc.integer(), () => {})).forEach(console.log)

Expected behavior

Doesn’t throw, prints out all the delicious generated parameters.

Your environment

Packages / Softwares Version(s)
fast-check 2.22.0
node 16.3.0
TypeScript* 4.5.5

*Only for TypeScript’s users

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dubzzzcommented, Feb 19, 2022

Woups this is indeed not expected. Good catch 😱

0reactions
dubzzzcommented, May 31, 2022

Fixed in v3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · dubzzz/fast-check - GitHub
Property based testing framework for JavaScript (like QuickCheck) written in TypeScript - Issues · dubzzz/fast-check.
Read more >
fast-check - npm
Property based testing framework for JavaScript (like QuickCheck). Latest version: 3.3.0, last published: 10 days ago.
Read more >
fast-check - Property based testing for JavaScript and TypeScript
Property based testing is another way to test programs. Instead of relying on hard-coded inputs and outputs, it checks characteristics of the output...
Read more >
Untitled
Inkerman ontario weather, Boc born mens boots, Stephen joseph gifts singapore, Ifugao language philippines, Tresham house dunchurch, Grammaire russe en ...
Read more >
Illund the S;5i S Transistor Transmitter - World Radio History
Please rush the new Model FC-2 FAST -CHECK TUBE TESTER for a 10 day trial period ... Throwing. Warping and Weaving. Worsted Manufacturing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found