We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using e.g. the EventName.Open type from the k6/experimental/websockets compiles but can't be run
EventName.Open
k6/experimental/websockets
k6 v0.56.0 (go1.23.4, darwin/arm64)
MacOS 15.3
No response
I have some code that can be summarised thus:
import { EventName, Params, WebSocket } from 'k6/experimental/websockets'; ... const ws = new WebSocket(`${websocketHost}/ocpp/1.6/`, null, params); ws.addEventListener(EventName.Open, () => { console.log('Connected'); }
I can try running it in several ways:
k6 run --compatibility-mode=experimental_enhanced src/idle-station.ts
k6pack src/idle-station.ts| k6 run -
find ./src -type f -name '*.ts' -exec esbuild '{}' --bundle --outbase=src --outdir=dist --external:k6 --format=esm \;
k6 run dist/idle-station.js
I expect the code to compile and run the test
For all of the above methods, I get this runtime error:
ERRO[0000] TypeError: Cannot read property 'Open' of undefined at idle_station_default (file:///Users/joff/src/chargefox/load-testing/dist/idle-station.js:16:33(19)) executor=shared-iterations scenario=default source=stacktrace
To work around this in the meantime -
I can either use the "open" literal in place of the enum:
"open"
ws.addEventListener('open', () => {
Although then my IDE complains of TS2345: Argument of type "open" is not assignable to parameter of type EventName
TS2345: Argument of type "open" is not assignable to parameter of type EventName
Or I can use a type assertion:
ws.addEventListener(<EventName>'open', () => {
Which isn't ideal either
The text was updated successfully, but these errors were encountered:
Hi, I'm starting to contribute to K6 and would like to help with this issue.
Sorry, something went wrong.
oleiade
No branches or pull requests
Brief summary
Using e.g. the
EventName.Open
type from thek6/experimental/websockets
compiles but can't be runk6 version
k6 v0.56.0 (go1.23.4, darwin/arm64)
OS
MacOS 15.3
Docker version and image (if applicable)
No response
Steps to reproduce the problem
I have some code that can be summarised thus:
I can try running it in several ways:
k6 run --compatibility-mode=experimental_enhanced src/idle-station.ts
k6pack src/idle-station.ts| k6 run -
find ./src -type f -name '*.ts' -exec esbuild '{}' --bundle --outbase=src --outdir=dist --external:k6 --format=esm \;
thenk6 run dist/idle-station.js
Expected behaviour
I expect the code to compile and run the test
Actual behaviour
For all of the above methods, I get this runtime error:
To work around this in the meantime -
I can either use the
"open"
literal in place of the enum:Although then my IDE complains of
TS2345: Argument of type "open" is not assignable to parameter of type EventName
Or I can use a type assertion:
Which isn't ideal either
The text was updated successfully, but these errors were encountered: