Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSModules ¶ added in v0.32.0
func GetJSModules() map[string]interface{}
GetJSModules returns a map of all registered js modules
Types ¶
type Exports ¶ added in v0.34.0
type Exports struct { // Default is what will be the `default` export of a module Default interface{} // Named is the named exports of a module Named map[string]interface{} }
Exports is representation of ESM exports of a module
type HasModuleInstancePerVU ¶ added in v0.32.0
type HasModuleInstancePerVU interface {
NewModuleInstancePerVU() interface{}
}
HasModuleInstancePerVU should be implemented by all native Golang modules that would require per-VU state. k6 will call their NewModuleInstancePerVU() methods every time a VU imports the module and use its result as the returned object.
type Instance ¶ added in v0.34.0
type Instance interface {
Exports() Exports
}
Instance is what a module needs to return
type Module ¶ added in v0.35.0
type Module interface { // NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU // This method will be called for *each* require/import and should return an unique instance for each call NewModuleInstance(VU) Instance }
Module is the interface js modules should implement in order to get access to the VU
type VU ¶ added in v0.35.0
type VU interface { // Context return the context.Context about the current VU Context() context.Context // InitEnv returns common.InitEnvironment instance if present InitEnv() *common.InitEnvironment // State returns lib.State if any is present State() *lib.State // Runtime returns the goja.Runtime for the current VU Runtime() *goja.Runtime }
VU gives access to the currently executing VU to a module Instance
Directories ¶
Path | Synopsis |
---|---|
Package k6 implements the module imported as 'k6' from inside k6.
|
Package k6 implements the module imported as 'k6' from inside k6. |
html
generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst
|
generated by js/modules/k6/html/gen/gen_elements.go directed by js/modules/k6/html/elements.go; DO NOT EDIT nolint: goconst |
Click to show internal directories.
Click to hide internal directories.