-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate random #91
Conversation
src/mersenne.ts
Outdated
@@ -36,3 +44,6 @@ export class Mersenne { | |||
this.gen.init_by_array(A, A.length); | |||
} | |||
} | |||
|
|||
export default Mersenne; | |||
module.exports = Mersenne; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this fails 🤔
> npx mocha test/random.unit.js
TypeError: mersenne_1.Mersenne is not a constructor
at new Faker (/home/shinigami/OpenSource/faker/lib/index.js:124:25)
at Object.<anonymous> (/home/shinigami/OpenSource/faker/index.js:3:13)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/shinigami/OpenSource/faker/test/random.unit.js:5:15)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.exports.requireOrImport (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/esm-utils.js:42:12)
at Object.exports.loadFilesAsync (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/esm-utils.js:55:34)
at Mocha.loadFilesAsync (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/mocha.js:473:19)
at singleRun (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/cli/run-helpers.js:125:15)
at exports.runMocha (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/cli/run-helpers.js:190:10)
at Object.exports.handler (/home/shinigami/OpenSource/faker/node_modules/mocha/lib/cli/run.js:362:11)
at /home/shinigami/OpenSource/faker/node_modules/mocha/node_modules/yargs/build/index.cjs:443:71
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to change the test 😬
- var mersenne = new (require('../lib/mersenne'));
+ var mersenne = new (require('../lib/mersenne').Mersenne);
And remove that again
export default Mersenne;
module.exports = Mersenne;
We need #90 to get merged, cause the tests depends on But also |
@@ -3,7 +3,7 @@ if (typeof module !== 'undefined') { | |||
var sinon = require('sinon'); | |||
var _ = require('lodash'); | |||
var faker = require('../index'); | |||
var mersenne = new (require('../lib/mersenne')); | |||
var mersenne = new (require('../lib/mersenne').Mersenne); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a breaking change, but hopefully no one tried to use it directly 🤔
So I would assume this breaking change would be okay and we just say that in the changelog, just to be safe
0e7e1ba
to
64b8db8
Compare
72dfa01
to
005a49f
Compare
test with
npm run build && npx mocha test/random.unit.js