-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
cjs: Importing specific locale in jest test fails with 'Cannot find module' #462
Comments
Can you try to provide a reproducible via https://stackblitz.com/edit/faker-js-demo?file=index.ts ? |
I have same issue after I upgraded it to 6.0.0 alpha. so I downgraded to 5.5.3 than problems gone. |
We are still missing a minimal reproduction, so maybe you could provide one? |
@shmuelsochet @hansonfang Please try out the |
We've noticed this issue again in version 8 when running our jest tests; error as follows: Test suite failed to run
Cannot find module '@faker-js/faker/locale/en' from 'node_modules/our-module/main.js Have downgraded to version 7 and it works. Is this something that can be looked at in version 8? |
Can you switch to the prepackaged faker instances available in v8 eg const { fakerEN : faker } = require('@faker-js/faker'); |
We have a legacy project that bundles this into the built code (work in progress to extract) so we were looking to just bring in the EN locale to reduce bundle size |
This issue is closed and I'm unable to reproduce the error locally. const { faker } = require("@faker-js/faker/locale/en");
console.log(typeof faker); // object
console.log(faker.person.firstName()); // Tatyana
console.log(faker.location.city()); // Fisherborough Please create a new issue and provide a minimal reproducible example. |
Describe the bug
When importing specific locale during a jest test, the test fails with the error
Cannot find module '@faker-js/faker/locale/en' from...
Reproduction
const faker = require('@faker-js/faker/locale/en');
on top of a jest file (i.e example.test.js)Additional Info
This does not occur when using the same import not during a jest test.
It also does not occur when not using specific locale like this
const { faker } = require('@faker-js/faker');
The text was updated successfully, but these errors were encountered: