Skip to content
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

Merged
merged 4 commits into from Jan 12, 2022
Merged

feat: migrate random #91

merged 4 commits into from Jan 12, 2022

Conversation

Shinigami92
Copy link
Member

test with npm run build && npx mocha test/random.unit.js

@Shinigami92 Shinigami92 added the p: 1-normal Nothing urgent label Jan 11, 2022
@Shinigami92 Shinigami92 self-assigned this Jan 11, 2022
@Shinigami92 Shinigami92 mentioned this pull request Jan 11, 2022
27 tasks
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;
Copy link
Member Author

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

Copy link
Member Author

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;

@Shinigami92
Copy link
Member Author

We need #90 to get merged, cause the tests depends on system

But also name 🤔

@Shinigami92 Shinigami92 marked this pull request as ready for review January 11, 2022 17:40
@@ -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);
Copy link
Member Author

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

@Shinigami92 Shinigami92 merged commit d2714fd into migrate-to-typescript Jan 12, 2022
@Shinigami92 Shinigami92 deleted the migrate-random branch January 12, 2022 18:03
Shinigami92 added a commit that referenced this pull request Jan 12, 2022
Shinigami92 added a commit that referenced this pull request Jan 12, 2022
Shinigami92 added a commit that referenced this pull request Jan 13, 2022
Shinigami92 added a commit that referenced this pull request Jan 14, 2022
Shinigami92 added a commit that referenced this pull request Jan 14, 2022
damienwebdev pushed a commit that referenced this pull request Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant