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

Migrate to a k6/js.modules.Module (ModulesV2) #20

Closed
olegbespalov opened this issue Jan 20, 2022 · 2 comments · Fixed by #28
Closed

Migrate to a k6/js.modules.Module (ModulesV2) #20

olegbespalov opened this issue Jan 20, 2022 · 2 comments · Fixed by #28

Comments

@olegbespalov
Copy link
Contributor

What?

In the k6 we deprecated, the usage of the old modules API and in the middle of the process of the migration to a new ModulesV2 API.

To do that, we need to clean up the usages of the deprecated methods:

grep --exclude-dir=vendor -Ri "common.Bind" .                   
./loki.go:	return common.Bind(
./loki.go:	return common.Bind(rt, &Client{
./loki.go:	return common.Bind(rt, &config.Labels, ctxPtr)

grep --exclude-dir=vendor -ER "With(State|InitEnv|Runtime)\(" ./
./batch_test.go:	ctx = lib.WithState(ctx, state)
./batch_test.go:	ctx = lib.WithState(ctx, state)

A good starting point can be our guide Create an extension.

Why?

The traditional approach of initializing JS modules involves calling common.Bind() on any objects that need to be exposed to JS. This method has a few technical issues we want to improve and isn't flexible enough to implement new features like giving extensions access to internal k6 objects.

@chaudum
Copy link
Collaborator

chaudum commented Jan 27, 2022

Changed with #22

@chaudum chaudum closed this as completed Jan 27, 2022
@mstoykov
Copy link
Contributor

This will actually be fixed in #28. #22 was fixing a different API breakage :(

@mstoykov mstoykov reopened this Feb 11, 2022
@mstoykov mstoykov linked a pull request Feb 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants