k6 icon indicating copy to clipboard operation
k6 copied to clipboard

test.abort return type should be never

Open MoKhajavi75 opened this issue 6 months ago • 0 comments
trafficstars

Brief summary

Hey

We have an abort function in k6 with this jsdoc:

/**
 * Aborts the test run with the exit code 108.
 * https://grafana.com/docs/k6/latest/javascript-api/k6-execution/#test
 * @param input - Aborted message.
 * @example
 * import exec from "k6/execution";
 * exec.test.abort();
 * exec.test.abort('this is the reason');
 */
abort(input?: string): void;

I guess the return type should be never instead of void Am I right or am I missing something? Have the never return type help narrow the scope, too.

If so, I would be happy to create the MR.

k6 version

k6 v1.0.0-rc1 (go1.24.1, darwin/arm64)

OS

macOS 15.4.1

MoKhajavi75 avatar Apr 28 '25 12:04 MoKhajavi75