indutny / miller-rabin

27 stars 12 forks source link

brorand.Rand is not a constructor, throw (exception) error #10

Open dipika21 opened 5 years ago

dipika21 commented 5 years ago

npm version : 5.10.0 node version : 8.9.4 phantomjs version : 2.1.1 (binary created from source code)

Facing below issue on Power RHEL and X86 Ubuntu also while npm run test:

miller-rabin/node_modules/yargs/yargs.js:1163 else throw err ^ TypeError: brorand.Rand is not a constructor

miller-rabin

NOTE: Updated packages to latest version from package.json to solve errors while doing npm install.

fanatid commented 5 years ago

npm run test cause this?

dipika21 commented 5 years ago

npm run test cause this?

yes (my bad, edited )

fanatid commented 5 years ago

I just run this command with node@8.9.4 on bda17a3 (v4.0.1) and everything work without errors. Can you try create brorand.Rand outside test?

const { Rand } = require('brorand')
const r = new Rand()
dipika21 commented 5 years ago

cloned again from repo, updated below packages: "mocha": "6.2.0" "bn.js": "5.0.0", to latest version to solve npm install deprecated error. npm install : DONE npm test facing error: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. so, added

"test": "mocha --timeout 10000" in package.json

npm test : DONE

Miller-Rabin ✓ should test number for primality (2713ms) 1 passing (3s)

fanatid commented 5 years ago

OK, my steps:

> mocha --reporter=spec test/**/*-test.js

  Miller-Rabin
    ✓ should test number for primality (726ms)

  1 passing (729ms)

¯\_(ツ)_/¯