testcheck-js icon indicating copy to clipboard operation
testcheck-js copied to clipboard

gen.oneOf throws an an error (not ISeqable)

Open customcommander opened this issue 6 years ago • 3 comments

The following code taken from the docs throws an error:

  • http://leebyron.com/testcheck-js/api#genoneof
  • Version: 1.0.0-rc.2
const numOrBool = gen.oneOf([ gen.int, gen.boolean ])

sample(numOrBool)

Output:

Error: [object Object],[object Object] is not ISeqable
    at E (/home/runner/node_modules/testcheck/dist/testcheck.js:90:423)
    at /home/runner/node_modules/testcheck/dist/testcheck.js:210:56
    at Ce (/home/runner/node_modules/testcheck/dist/testcheck.js:160:54)
    at Be.h.Y (/home/runner/node_modules/testcheck/dist/testcheck.js:162:291)
    at E (/home/runner/node_modules/testcheck/dist/testcheck.js:90:313)
    at Xe (/home/runner/node_modules/testcheck/dist/testcheck.js:183:52)
    at to (/home/runner/node_modules/testcheck/dist/testcheck.js:442:143)
    at Object.exports.gen.oneOf (/home/runner/node_modules/testcheck/dist/testcheck.js:734:136)
    at evalmachine.<anonymous>:3:23
    at Script.runInContext (vm.js:133:20)

customcommander avatar Nov 01 '19 10:11 customcommander

@leebyron I love testcheck and would like to introduce it at work but this bug is a showstopper for me. I just want to know if you're still maintaining this project.

customcommander avatar Nov 01 '19 12:11 customcommander

Looks like this relates to #42

camsjams avatar Dec 05 '19 18:12 camsjams

On testcheck @1.0.0-rc.2 this code seems to function fine within the scope of node or a webpack/babel/TypeScript (@3.7.2) build.

It generates a value like: [ false, false, true, true, -3, true, false, true, false, 4 ]

Can also be verified with latest on npm: https://npm.runkit.com/testcheck using this code:

const {gen, sample} = require("testcheck")

const numOrBool = gen.oneOf([ gen.int, gen.boolean ])

sample(numOrBool)

@customcommander can you share a little more about your code and versons:

  • Node version
  • TypeScript (if using)
  • Babel (if using)

camsjams avatar Dec 14 '19 00:12 camsjams