Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/global/scripts_test.go
2070 views
1
package global
2
3
import (
4
"testing"
5
6
"github.com/Mzack9999/goja"
7
"github.com/Mzack9999/goja_nodejs/console"
8
"github.com/Mzack9999/goja_nodejs/require"
9
)
10
11
func TestScriptsRuntime(t *testing.T) {
12
defaultImports = ""
13
runtime := goja.New()
14
15
registry := new(require.Registry)
16
registry.Enable(runtime)
17
console.Enable(runtime)
18
19
err := RegisterNativeScripts(runtime)
20
if err != nil {
21
t.Fatal(err)
22
}
23
value, err := runtime.RunString("dump_json({a: 1, b: 2})")
24
if err != nil {
25
t.Fatal(err)
26
}
27
_ = value
28
}
29
30