Hi, team!
We have couple of custom k6 extensions implemented in golang that we use in our project. They all were written when 0.37.0 was the latest version. Recently, we decided to upgrade to 0.42.0 and discovered that there are some changes in k6 golang libs that require changes in our code.
I got couple of questions on how to do this properly:
- We used to pass k6 context to our functions like this:
func (*MyModule) SomeFunction(ctx context.Context, ...) {}
when compiling k6 binary for 0.42.0 and running test with it we get invalid number of parameters error - looks like context is not passed automatically to function call. has something changed in this area?
- We use to throw js errors in our code as the following:
common.Throw(common.GetRuntime(ctx), "some error")
In 0.42.0 GetRuntime function is deprecated in k6 common module. What is the correct way to get goja runtime in that case?
Thanks in advance for any help!