Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streams: just use modulestest to get setTimeout and co. #4189

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions js/modules/k6/experimental/streams/readable_streams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"

"go.k6.io/k6/js/modules"
"go.k6.io/k6/js/modules/k6/timers"
"go.k6.io/k6/js/modulestest"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -45,15 +44,12 @@ func TestReadableStream(t *testing.T) {
func newConfiguredRuntime(t testing.TB) *modulestest.Runtime {
rt := modulestest.NewRuntime(t)

require.NoError(t, rt.SetupModuleSystem(nil, nil, nil))

// We want to make the [self] available for Web Platform Tests, as it is used in test harness.
_, err := rt.VU.Runtime().RunString("var self = this;")
require.NoError(t, err)

// We also want to make [timers.Timers] available for Web Platform Tests.
for k, v := range timers.New().NewModuleInstance(rt.VU).Exports().Named {
require.NoError(t, rt.VU.RuntimeField.Set(k, v))
}

// We also want the streams module exports to be globally available.
m := new(RootModule).NewModuleInstance(rt.VU)
for k, v := range m.Exports().Named {
Expand Down
Loading