k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Generate random data and format

Open AugustoRickes opened this issue 1 year ago • 1 comments

Feature Description

ERRO[0000] GoError: The moduleSpecifier "randomdatek6" couldn't be recognised as something k6 supports.
        at go.k6.io/k6/js.(*requireImpl).require-fm (native)
        at file:{path-to-my-script}  hint="script exception"

The purpose of this library is to simplify date manipulation tasks by providing two key utilities:

Random Date Generation: Create a random date between two given dates, which can be useful for generating test data or simulating events within a specific timeframe.

Date Formatting: Convert a Date object into a readable string format (YYYY-MM-DD HH:mm), making it easier to display dates in a consistent and user-friendly manner.

npm: https://www.npmjs.com/package/randomdatek6?activeTab=readme

Suggested Solution (optional)

Add support to the library

Already existing or connected issues / PRs (optional)

No response

AugustoRickes avatar Aug 04 '24 00:08 AugustoRickes

Hi @AugustoRickes,

Have you seen the k6 docs around using Node.js modules? I'd say that, at first glance, this looks like an expected error. Could you double-check that, and confirm it, please?

If you're looking for a fake data generator, you can take a look at the xk6-faker extension. Or try to package the randomdatek6 package in a way that works in k6, following the suggestions in the aforementioned docs.

Thanks! 🙇🏻

joanlopez avatar Oct 03 '24 08:10 joanlopez

Closing as there has been no reply for a while, and because this looks more like a discussion that can be handled in https://community.grafana.com/c/grafana-k6/70, instead of an actual bug or feature request for k6.

joanlopez avatar May 21 '25 14:05 joanlopez