Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

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

Closed
olegbespalov opened this issue Jan 20, 2022 · 0 comments · Fixed by #5
Closed

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

olegbespalov opened this issue Jan 20, 2022 · 0 comments · Fixed by #5

Comments

@olegbespalov
Copy link

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" .
./internal/k8s/k8s.go:	return common.Bind(rt, p, ctx), nil
./internal/experiments/experiments.go:	return common.Bind(rt, p, ctx), nil

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.

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

Successfully merging a pull request may close this issue.

1 participant