MCPcopy
hub / github.com/grafana/k6 / getCurrentModuleScript

Function getCurrentModuleScript

js/modules/require_impl.go:186–197  ·  view source on GitHub ↗
(vu VU)

Source from the content-addressed store, hash-verified

184}
185
186func getCurrentModuleScript(vu VU) string {
187 rt := vu.Runtime()
188 var parent string
189 var buf [2]sobek.StackFrame
190 frames := rt.CaptureCallStack(2, buf[:0])
191 if len(frames) == 0 || frames[1].SrcName() == "file:///-" {
192 return vu.InitEnv().CWD.JoinPath("./-").String()
193 }
194 parent = frames[1].SrcName()
195
196 return parent
197}
198
199func getPreviousRequiringFile(vu VU) (string, error) {
200 rt := vu.Runtime()

Calls 3

RuntimeMethod · 0.65
InitEnvMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…