Asynchronous Methods Within K6 Load Tests

Hello I am using k6 with webpack so that I could have the ability to import external npm package dependencies to help with generating the required test data that I need in order to setup my load tests.

However, I am running into an issue here where I have a private npm package which contains a set of asynchronous methods that I use to generate test data by making calls to several services. I was wondering if there is any way to use this external package, or am I going to have to build out these methods again with the use of the k6 async method ( asyncRequest( method, url, [body], [params] ) | Grafana k6 documentation )

import { buildOptions } from './options';
import { testBffClient } from '@test-automation';

const testName = 'as_loadTest_getEncounters';
export const options = buildOptions(testName);

interface SetupData {
  result: string;
}

export async function setup(): Promise<SetupData> {
  const testClient = new testBffClient(
    'https://test.io',
  );
  const response = await testClient.authenticate('username', 'password');
  return {
    result: response.access_token
  }
}

export default function (data: SetupData): void {
  console.log(data.result);
}

This is my example load script that I have and I’m currently getting this error

ERRO[0000] GoError: file:///Users/elijah.taylor-kuni/Github/activity-service/release-readiness/dist/getUserEncounters.test.js: Line 2:30962 Unexpected token await (and 9 more errors)  hint="script exception"