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

Can't use Faker with k6 #2872

Open
pawfectQA opened this issue May 3, 2024 · 15 comments
Open

Can't use Faker with k6 #2872

pawfectQA opened this issue May 3, 2024 · 15 comments
Labels
question Further information is requested s: awaiting more info Additional information are requested s: pending triage Pending Triage

Comments

@pawfectQA
Copy link

Clear and concise description of the problem

As a QA using faker I wish that I could use updated faker with k6 scripts. Now I get an error, that k6 doesn't support this module. I import it as import { faker } from "@faker-js/faker";, and when I run tests, I get this message: GoError: The moduleSpecifier "@faker-js/faker" couldn't be recognised as something k6 supports.
at go.k6.io/k6/js.(*requireImpl).require-fm (native)

Suggested solution

Maybe this helps somehow k6 docs

Alternative

No response

Additional context

No response

@pawfectQA pawfectQA added c: feature Request for new feature s: pending triage Pending Triage s: waiting for user interest Waiting for more users interested in this feature labels May 3, 2024
Copy link

github-actions bot commented May 3, 2024

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

  • If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
  • If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.

We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.

We will start the implementation based on:

  • the number of votes (:+1:) and comments
  • the relevance for the ecosystem
  • availability of alternatives and workarounds
  • and the complexity of the requested feature

We do this because:

  • There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
  • Every feature we add to faker has "costs" associated to it:
    • initial costs: design, implementation, reviews, documentation
    • running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors

View more issues which are waiting for user interest

@ST-DDT ST-DDT added question Further information is requested and removed c: feature Request for new feature s: waiting for user interest Waiting for more users interested in this feature labels May 3, 2024
@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

Please provide us with a minimal reproduction example, so that we can have an in detail look at it and verify the solution ourselves.

@ST-DDT ST-DDT added the s: awaiting more info Additional information are requested label May 3, 2024
@pawfectQA
Copy link
Author

test issue.zip
the code itself can be with mistakes, but it lets test the issue. Thank you!

@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

@pawfectQA Thanks for providing the zip. Which version of k6 are you using?
I know you have included the exe in the zip, but I cannot verify its integrity as it seems to be an older version.

EDIT: ⚠️ The checksums of the zipped and the v0.49 from github don't match.

@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

Have you tried with the latest version of k6 as well?

@pawfectQA
Copy link
Author

I use v0.49 of k6

@pawfectQA
Copy link
Author

I tried the latest version and it has the same issue.

@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

⚠️ The checksums of the zipped and the v0.49 from github don't match.

@pawfectQA
Copy link
Author

the zipped one may be lower version because it includes some extension 🧐 but I tried all the latest versions too

@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

Instead of importing from @faker-js/faker try https://cdn.jsdelivr.net/npm/@faker-js/faker@8.4.1/dist/esm/locale/en.mjs

or adding a package.json with @faker-js/faker as depedency and run npm install and then use ./node_modules/@faker-js/faker.

@ST-DDT
Copy link
Member

ST-DDT commented May 3, 2024

Does that help you/fix the issues you have?

@pawfectQA
Copy link
Author

It says: WARN[0002] The source for https://cdn.jsdelivr.net/npm/@faker-js/faker@8.4.1/dist/esm/chunk-LSZKOVGW.mjs needs to go through babel but is over 256000 bytes. For performance reasons source map support will be disabled for this particular file.

Still investigating

@pawfectQA
Copy link
Author

and the second method gave me "node_modules@faker-js\faker: Incorrect function."

@ST-DDT
Copy link
Member

ST-DDT commented May 15, 2024

and the second method gave me "node_modules@faker-js\faker: Incorrect function."

You might have to adjust the path to match your actual file system.

@ST-DDT
Copy link
Member

ST-DDT commented May 15, 2024

Did you have any luck getting this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested s: awaiting more info Additional information are requested s: pending triage Pending Triage
Projects
None yet
Development

No branches or pull requests

2 participants