Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit ae5c339

Browse files
committed
Add a test to ensure that module can be disabled
1 parent abcfa44 commit ae5c339

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

browser/module_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/dop251/goja"
7+
"github.com/stretchr/testify/assert"
78
"github.com/stretchr/testify/require"
89

910
"github.com/grafana/xk6-browser/chromium"
@@ -32,3 +33,15 @@ func TestModuleNew(t *testing.T) {
3233
require.NotNil(t, m.mod.Devices, "Devices should be set")
3334
require.Equal(t, m.mod.Version, version, "Incorrect version")
3435
}
36+
37+
func TestModuleNewDisabled(t *testing.T) {
38+
t.Setenv("K6_BROWSER_DISABLE_RUN", "")
39+
40+
vu := &k6modulestest.VU{
41+
RuntimeField: goja.New(),
42+
InitEnvField: &k6common.InitEnvironment{
43+
Registry: k6metrics.NewRegistry(),
44+
},
45+
}
46+
assert.Panics(t, func() { New().NewModuleInstance(vu) })
47+
}

0 commit comments

Comments
 (0)