diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c527caf --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,41 @@ +{ + "name": "xk6-faker", + "image": "mcr.microsoft.com/devcontainers/base:1-bookworm", + "customizations": { + "vscode": { + "settings": { + "go.lintTool": "golangci-lint", + "go.lintFlags": ["--fast"], + "go.buildTags": "codegen" + }, + "extensions": [ + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "jetmartin.bats", + "mads-hartmann.bash-ide-vscode", + "foxundermoon.shell-format" + ] + } + }, + + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/go:1": { + "version": "1.23", + "golangciLintVersion": "1.63.4" + }, + "ghcr.io/guiyomh/features/goreleaser:0": { "version": "2.6.1" }, + "ghcr.io/michidk/devcontainers-features/bun:1": { "version": "1.2.1" }, + "ghcr.io/szkiba/devcontainer-features/cdo:1": { "version": "0.1.2" }, + "ghcr.io/szkiba/devcontainer-features/mdcode:1": { "version": "0.2.0" }, + "ghcr.io/szkiba/devcontainer-features/bats:1": { "version": "1.11.1" }, + "ghcr.io/grafana/devcontainer-features/xk6:1": { "version": "0.14.0" } + }, + + "remoteEnv": { + "GH_TOKEN": "${localEnv:GH_TOKEN}", + "GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1913185 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true + +[*.{yml,yaml,json,sh,bats}] +indent_size = 2 +trim_trailing_whitespace = true + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore index 3d2b39a..ee813ca 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ /node_modules yarn.lock bun.lockb -/coverage.out \ No newline at end of file +/coverage.txt \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index cdd1054..8a4f951 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,135 +1,31 @@ -# v1.55.2 -# Please don't remove the first line. It uses in CI to determine the golangci version -run: - deadline: 5m +# v1.63.4 +# Please don't remove the first line. This is a must until the reusable GitHub workflow is refactored. issues: - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. max-issues-per-linter: 0 - # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0 - - # We want to try and improve the comments in the k6 codebase, so individual - # non-golint items from the default exclusion list will gradually be added - # to the exclude-rules below exclude-use-default: false - exclude-rules: - # Exclude duplicate code and function length and complexity checking in test - # files (due to common repeats and long functions in test code) - - path: _(test|gen)\.go - linters: - - cyclop - - dupl - - gocognit - - funlen - - lll - - path: js\/modules\/k6\/http\/.*_test\.go - linters: - # k6/http module's tests are quite complex because they often have several nested levels. - # The module is in maintainance mode, so we don't intend to port the tests to a parallel version. - - paralleltest - - tparallel - - linters: - - staticcheck # Tracked in https://github.com/grafana/xk6-grpc/issues/14 - text: "The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated." - - linters: - - forbidigo - text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden' - -linters-settings: - nolintlint: - # Disable to ensure that nolint directives don't have a leading space. Default is true. - allow-leading-space: false - exhaustive: - default-signifies-exhaustive: true - govet: - check-shadowing: true - cyclop: - max-complexity: 25 - maligned: - suggest-new: true - dupl: - threshold: 150 - goconst: - min-len: 10 - min-occurrences: 4 - funlen: - lines: 80 - statements: 60 - forbidigo: - forbid: - - '^(fmt\\.Print(|f|ln)|print|println)$' - # Forbid everything in os, except os.Signal and os.SyscalError - - '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?' - # Forbid everything in syscall except the uppercase constants - - '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?' - - '^logrus\.Logger$' - linters: - disable-all: true - enable: - - asasalint - - asciicheck - - bidichk - - bodyclose - - contextcheck - - cyclop - - dogsled - - dupl - - durationcheck - - errcheck - - errchkjson - - errname - - errorlint - - exhaustive + enable-all: true + disable: + - wrapcheck + - varnamelen + - exhaustruct - exportloopref - - forbidigo - - forcetypeassert - - funlen - - gocheckcompilerdirectives - - gochecknoglobals - - gocognit - - goconst - - gocritic - - gofmt - - gofumpt - - goimports - - gomoddirectives - - goprintffuncname - - gosec - - gosimple - - govet - - importas - - ineffassign - - interfacebloat - - lll - - makezero - - misspell - - nakedret - - nestif - - nilerr - - nilnil - - noctx - - nolintlint - - nosprintfhostport - - paralleltest - - prealloc - - predeclared - - promlinter - - revive - - reassign - - rowserrcheck - - sqlclosecheck - - staticcheck - - stylecheck - - tenv - - tparallel - - typecheck - - unconvert - - unparam - - unused - - usestdlibvars - - wastedassign - - whitespace - fast: false + - gochecknoinits + - ireturn + +linters-settings: + depguard: + rules: + prevent_accidental_imports: + allow: + - $gostd + - github.com/brianvoe/gofakeit/v6 + - github.com/stretchr/testify/require + - lukechampine.com/frand + - github.com/iancoleman/strcase + - github.com/grafana/sobek + - github.com/grafana/k6 + - github.com/grafana/xk6-faker diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cb6adc1..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "go.lintTool": "golangci-lint", - "go.lintFlags": ["--fast"], - "go.buildTags": "codegen" -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d3c40f..e1393ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,24 +1,55 @@ # Contributing Guidelines -Thank you for your interest in contributing to **xk6-faker**! +Thank you for your interest in contributing! + +All types of contributions are encouraged and valued. Please make sure to read this document before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues + +## Code of Conduct Before you begin, make sure to familiarize yourself with the [Code of Conduct](CODE_OF_CONDUCT.md). If you've previously contributed to other open source project, you may recognize it as the classic [Contributor Covenant](https://contributor-covenant.org/). -If you want to chat with the team or the community, you can [join our community forums](https://community.grafana.com/c/grafana-k6). +## Asking questions + +Before you ask a question, it is best to search for existing [Issues](https://github.com/grafana/xk6-faker/issues) that might help you. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification or if you want to chat with the team or the community, you can [join our community forums](https://community.grafana.com/c/grafana-k6). + +## Reporting Bugs + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. + +We use [GitHub issues](https://github.com/grafana/xk6-faker/issues) to track bugs and errors. If you run into an issue with the project: -### Filing issues +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error. +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Open an [Issue](https://github.com/grafana/xk6-faker/issues). +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. -Don't be afraid to file issues! Nobody can fix a bug we don't know exists, or add a feature we didn't think of. +## Suggesting Enhancements -The worst that can happen is that someone closes it and points you in the right direction. +Enhancement suggestions are tracked as [GitHub issues](https://github.com/grafana/xk6-faker/issues). -That said, "how do I..."-type questions are often more suited for [community forums](https://community.grafana.com/c/grafana-k6). +- Make sure that you are using the latest version. +- Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a search in [Issues](https://github.com/grafana/xk6-faker/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- **Explain why this enhancement would be useful** to most of users. You may also want to point out the other projects that solved it better and which could serve as inspiration. -### Contributing code +## Contributing code If you'd like to contribute code, this is the basic procedure. -1. Find an issue you'd like to fix. If there is none already, or you'd like to add a feature, please open one, and we can talk about how to do it. Out of respect for your time, please start a discussion regarding any bigger contributions either in a GitHub Issue, in the community forums **before** you get started on the implementation. +1. Find an [issue](https://github.com/grafana/xk6-faker/issues) you'd like to fix. If there is none already, or you'd like to add a feature, please open one, and we can talk about how to do it. Out of respect for your time, please start a discussion regarding any bigger contributions either in a [GitHub Issue](https://github.com/grafana/xk6-faker/issues), in the community forums **before** you get started on the implementation. Remember, there's more to software development than code; if it's not properly planned, stuff gets messy real fast. @@ -28,71 +59,58 @@ If you'd like to contribute code, this is the basic procedure. 4. We will discuss implementation details until everyone is happy, then a maintainer will merge it. -## Prerequisites +## Development Environment -Prerequisites are listed in the [tools] section in addition to the [go toolchain](https://go101.org/article/go-toolchain.html) and [git](https://git-scm.com/) CLI. +We use [Development Containers](https://containers.dev/) to provide a reproducible development environment. We recommend that you do the same. In this way, it is guaranteed that the appropriate version of the tools required for development will be available. -The `Makefile` is generated from the task list defined in the `CONTRIBUTING.md` file using the [cdo] tool. If the contribution is made to the task list, the `Makefile` must be regenerated, which is why the [cdo] tool is needed. The [cdo] tool can most conveniently be installed using the [eget] tool. +**Without installing software** -```bash -eget szkiba/cdo -``` +You can *contribute without installing any software* using [GitHub Codespaces](https://docs.github.com/en/codespaces). After forking the repository, [create a codespace for your repository](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository). -[cdo]: https://github.com/szkiba/cdo -[eget]: https://github.com/zyedidia/eget +**Using an IDE** -## Tasks +You can contribute conveniently using [Visual Studio Code](https://code.visualstudio.com/) by installing the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. You *don't need to install any other software* to contribute. Clone your repository and open the folder with Visual Studio Code. It will automatically detect that the folder contains a Dev Container configuration and ask you whether to open the folder in a container. Choose **"Reopen in Container"**. -The tasks defined here can be executed manually or conveniently using the make or [cdo] tool. +[JetBrains GoLand](https://www.jetbrains.com/help/go/connect-to-devcontainer.html) also has DevContainers support. -**Help about tasks** +It is worth mentioning [DevPod](https://devpod.sh/docs/) in addition to the above. -The command below lists the possible tasks. +**The hard way** -using make: +All the tools used for development are free and open-source, so you can install them without using *Development Containers*. The `.devcontainer/devcontainer.json` file contains a list of the tools to be installed and their version numbers. -```bash -make -``` +### Updating tool versions -using [cdo]: +The version numbers of tools used in GitHub workflows are defined as [repository variables](https://github.com/grafana/xk6-faker/settings/variables/actions). The version numbers of tools used in the *Development Containers* are only defined in the `.devcontainer/devcontainer.json` file. The version numbers should be updated carefully to be consistent. -```bash -cdo -``` +## Tasks -**Execute task** +The usual contributor tasks can be performed using GNU make. The `Makefile` defines a target for each task. To execute a task, the name of the task must be specified as an argument to the make command. -Tasks are executed by passing the name of the task as a parameter. +```bash +make taskname +``` -using make: +Help on the available targets and their descriptions can be obtained by issuing the `make` command without any arguments. ```bash -make taskname +make ``` -using [cdo]: +More detailed help can be obtained for individual tasks using the [cdo](https://github.com/szkiba/cdo) command: ```bash -cdo taskname +cdo taskname --help ``` -### tools - Install the required tools +**Authoring the Makefile** -Contributing will require the use of some tools, which can be installed most easily with a well-configured [eget] tool. +The `Makefile` is generated from the task list defined in the `CONTRIBUTING.md` file using the [cdo](https://github.com/szkiba/cdo) tool. If a contribution has been made to the task list, the `Makefile` must be regenerated using the [makefile] target. ```bash -eget szkiba/mdcode -eget golangci/golangci-lint -eget grafana/xk6 -eget oven-sh/bun +make makefile ``` -[tools]: #tools---install-the-required-tools -[xk6]: https://github.com/grafana/xk6 -[mdcode]: https://github.com/szkiba/mdcode -[golangci-lint]: https://github.com/golangci/golangci-lint - ### lint - Run the linter The [golangci-lint] tool is used for static analysis of the source code. It is advisable to run it before committing the changes. @@ -101,12 +119,14 @@ The [golangci-lint] tool is used for static analysis of the source code. It is a golangci-lint run ``` +[golangci-lint]: https://github.com/golangci/golangci-lint + ### test - Run the tests The `go test` command is used to run the tests and generate the coverage report. ```bash -go test -count 1 -race -coverprofile=coverage.out -timeout 60s ./... +go test -count 1 -race -coverprofile=coverage.txt -timeout 60s ./... ``` [test]: <#test---run-the-tests> @@ -119,7 +139,7 @@ Requires : [test] ```bash -go tool cover -html=coverage.out +go tool cover -html=coverage.txt ``` ### build - Build custom k6 with extension @@ -130,6 +150,7 @@ The [xk6] tool is used to build the k6. xk6 build --with github.com/grafana/xk6-faker=. ``` +[xk6]: https://github.com/grafana/xk6 [build]: <#build---build-custom-k6-with-extension> ### example - Run the examples @@ -137,10 +158,7 @@ xk6 build --with github.com/grafana/xk6-faker=. Run the examples embedded in `README.md`. ```bash -./k6 run examples/default-faker.js -./k6 run examples/custom-faker.js -export XK6_FAKER_SEED=11 - ./k6 run examples/default-faker-env.js +bats ./examples ``` [example]: #example---run-the-examples @@ -153,12 +171,14 @@ Update the example code and its output in `README.md` using [mdcode] tool. mdcode update ``` +[mdcode]: + ### clean - Clean the working directory Delete the work files created in the work directory (also included in .gitignore). ```bash -rm -rf ./k6 ./coverage.out ./build ./node_modules ./bun.lockb +rm -rf ./k6 ./coverage.txt ./build ./node_modules ./bun.lockb ``` [clean]: #clean---clean-the-working-directory @@ -193,3 +213,4 @@ go fmt ./... ```bash cdo --makefile Makefile ``` +[makefile]: <#makefile---generate-the-makefile> \ No newline at end of file diff --git a/Makefile b/Makefile index 5e15c5e..13933d9 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ __help__: @echo ' makefile Generate the Makefile' @echo ' readme Update README.md' @echo ' test Run the tests' - @echo ' tools Install the required tools' # Clean build .PHONY: all @@ -36,14 +35,14 @@ build: .PHONY: clean clean: @(\ - rm -rf ./k6 ./coverage.out ./build ./node_modules ./bun.lockb;\ + rm -rf ./k6 ./coverage.txt ./build ./node_modules ./bun.lockb;\ ) # View the test coverage report .PHONY: coverage coverage: test @(\ - go tool cover -html=coverage.out;\ + go tool cover -html=coverage.txt;\ ) # Generate API documentation @@ -57,10 +56,7 @@ doc: .PHONY: example example: @(\ - ./k6 run examples/default-faker.js;\ - ./k6 run examples/custom-faker.js;\ - export XK6_FAKER_SEED=11;\ - ./k6 run examples/default-faker-env.js;\ + bats ./examples;\ ) # Format the go source codes @@ -95,16 +91,6 @@ readme: .PHONY: test test: @(\ - go test -count 1 -race -coverprofile=coverage.out -timeout 60s ./...;\ - ) - -# Install the required tools -.PHONY: tools -tools: - @(\ - eget szkiba/mdcode;\ - eget golangci/golangci-lint;\ - eget grafana/xk6;\ - eget oven-sh/bun;\ + go test -count 1 -race -coverprofile=coverage.txt -timeout 60s ./...;\ ) diff --git a/README.md b/README.md index 4b4d429..5b6e36e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,23 @@ For convenience, the xk6-faker API resembles the popular [Faker.js](https://fake Check out the API documentation [here](https://faker.x.k6.io). The TypeScript declaration file can be downloaded from [here](https://faker.x.k6.io/index.d.ts). +> [!NOTE] +> To use the TypeScript declaration file in your IDE (e.g. Visual Studio Code), you need to create a `jsconfig.json` (or `tsconfig.json`) file with the following content: +> +> ```json file=examples/jsconfig.json +> { +> "compilerOptions": { +> "target": "ES6", +> "module": "ES6", +> "paths": { +> "k6/x/faker": ["./typings/xk6-faker/index.d.ts"] +> } +> } +>} +>``` +> You will need to update the TypeScript declaration file location in the example above to where you downloaded it. + + ## Usage For convenient use, the default export of the module is a Faker instance, it just needs to be imported and it is ready for use. diff --git a/examples/examples.bats b/examples/examples.bats new file mode 100755 index 0000000..16d1a77 --- /dev/null +++ b/examples/examples.bats @@ -0,0 +1,32 @@ +#!/usr/bin/env bats + +setup() { + cd "$BATS_TEST_DIRNAME" + BASEDIR="$(git rev-parse --show-toplevel)" + EXE="$BASEDIR/k6" + + if [ ! -x "$EXE" ]; then + echo " - building k6" >&3 + cd "$BASEDIR" + xk6 build --with github.com/grafana/xk6-faker=. + cd "$BATS_TEST_DIRNAME" + fi +} + +@test 'default-faker.js' { + run $EXE run default-faker.js + [ $status -eq 0 ] +} + +@test 'custom-faker.js' { + run $EXE run custom-faker.js + [ $status -eq 0 ] + echo "$output" | grep -q "msg=Josiah" +} + +@test 'default-faker-env.js' { + export XK6_FAKER_SEED=11 + run $EXE run default-faker-env.js + [ $status -eq 0 ] + echo "$output" | grep -q "msg=Josiah" +} diff --git a/examples/jsconfig.json b/examples/jsconfig.json new file mode 100644 index 0000000..cc39508 --- /dev/null +++ b/examples/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "ES6", + "paths": { + "k6/x/faker": ["./typings/xk6-faker/index.d.ts"] + } + } +} diff --git a/faker/faker.go b/faker/faker.go index bb5372e..7c67f39 100644 --- a/faker/faker.go +++ b/faker/faker.go @@ -109,6 +109,7 @@ func (f *faker) toMapParams(info *gofakeit.Info, call sobek.FunctionCall) *gofak if sobek.IsUndefined(val) { if len(param.Default) != 0 { params.Add(param.Field, param.Default) + continue } diff --git a/faker/fumctions_test.go b/faker/fumctions_test.go index 74fcf4f..835b511 100644 --- a/faker/fumctions_test.go +++ b/faker/fumctions_test.go @@ -17,9 +17,9 @@ func Test_lookup(t *testing.T) { funcs := []string{"creditcardstring", "creditcardexpmonth", "creditcardexpyear"} for _, fun := range funcs { - fun := fun t.Run(fun, func(t *testing.T) { t.Parallel() + info := gofakeit.GetFuncLookup(fun) require.NotNil(t, info) @@ -71,7 +71,7 @@ func Test_creditcardexpmonth(t *testing.T) { require.NoError(t, err) - require.Greater(t, month, 0) + require.Positive(t, month) require.Less(t, month, 13) } diff --git a/faker/functions.go b/faker/functions.go index 023428c..1b192d5 100644 --- a/faker/functions.go +++ b/faker/functions.go @@ -54,7 +54,9 @@ func creditcardstring(r *rand.Rand, _ *gofakeit.MapParams, _ *gofakeit.Info) (an } func creditcardexpmonth(r *rand.Rand, _ *gofakeit.MapParams, _ *gofakeit.Info) (any, error) { - month := strconv.Itoa(1 + r.Intn(12)) + const months = 12 + + month := strconv.Itoa(1 + r.Intn(months)) if len(month) == 1 { month = "0" + month } @@ -63,7 +65,11 @@ func creditcardexpmonth(r *rand.Rand, _ *gofakeit.MapParams, _ *gofakeit.Info) ( } func creditcardexpyear(r *rand.Rand, _ *gofakeit.MapParams, _ *gofakeit.Info) (any, error) { - current := time.Now().Year() - 2000 + const Y2K = 2000 + + current := time.Now().Year() - Y2K + + const maxYear = 10 - return strconv.Itoa(current + 1 + r.Intn(10)), nil + return strconv.Itoa(current + 1 + r.Intn(maxYear)), nil } diff --git a/faker/lookup.go b/faker/lookup.go index 135ddea..13f185b 100644 --- a/faker/lookup.go +++ b/faker/lookup.go @@ -32,6 +32,7 @@ func lookupCategory(name string) (map[string]*gofakeit.Info, bool) { requireFuncLookups() funcs, ok := _categoryFuncs[name] + return funcs, ok } @@ -39,6 +40,7 @@ func lookupFunc(name string) (*gofakeit.Info, bool) { requireFuncLookups() fun, ok := _funcLookups[name] + return fun, ok } @@ -138,7 +140,6 @@ func convertFuncLookups() { continue } - info := info key = fixLookup(key, &info) _funcLookups[key] = &info diff --git a/functions_test.go b/functions_internal_test.go similarity index 100% rename from functions_test.go rename to functions_internal_test.go diff --git a/module/module_internal_test.go b/module/module_internal_test.go index 73d46ef..1843ade 100644 --- a/module/module_internal_test.go +++ b/module/module_internal_test.go @@ -19,6 +19,7 @@ func Test_getseed(t *testing.T) { vu.InitEnvField.RuntimeOptions.Env = map[string]string{} vu.InitEnvField.LookupEnv = func(key string) (string, bool) { val, ok := vu.InitEnvField.RuntimeOptions.Env[key] + return val, ok } diff --git a/module/module_test.go b/module/module_test.go index f7fe567..8b6fe34 100644 --- a/module/module_test.go +++ b/module/module_test.go @@ -16,6 +16,7 @@ func Test_Default_Faker(t *testing.T) { runtime.VU.InitEnvField.LookupEnv = func(key string) (string, bool) { val, ok := runtime.VU.InitEnvField.RuntimeOptions.Env[key] + return val, ok } diff --git a/register.go b/register.go index d8b71cb..a39e9ff 100644 --- a/register.go +++ b/register.go @@ -3,7 +3,6 @@ package faker import ( "github.com/grafana/xk6-faker/module" - "go.k6.io/k6/js/modules" ) diff --git a/releases/v0.4.2.md b/releases/v0.4.2.md new file mode 100644 index 0000000..316c262 --- /dev/null +++ b/releases/v0.4.2.md @@ -0,0 +1,6 @@ +xk6-faker `v0.4.2` is here 🎉! + +This is a maintenance release, changes: + +- Simplify contribution with support for reproducible development environments ([Development Containers](https://containers.dev/)). +- Updated documentation for typings to work with VSCode ([#47](https://github.com/grafana/xk6-faker/issues/47)) diff --git a/tsconfig.json b/tsconfig.json index 7ebc37f..a70c66b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,11 +18,13 @@ } }, "compilerOptions": { - "target": "es6", - "module": "commonjs", + "target": "ES6", + "module": "ES6", + "paths": { + "k6/x/faker": ["./index.d.ts"] + }, "esModuleInterop": true, "strict": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true + "forceConsistentCasingInFileNames": true } }