k6-template-typescript icon indicating copy to clipboard operation
k6-template-typescript copied to clipboard

Module build failed : Unexpected token, expected ","

Open Vignesh-527 opened this issue 1 year ago • 0 comments

I am new to k6 and have been using it to test a react web application written in typescript. So I am using this template to compile the typescript component to javascript. I cloned the template to the existing project folder and created a .ts file and scripted the test script in it. It calls to other components in the project folder that is in typescript. So when I imported them in the current test script and I run the "npm run bundle" I am repeatedly getting the same error in 4 different components

ERROR in ../src/e2e/helpers/resetLocalStorage.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\vignesh.t\SkillfitFrontend\src\e2e\helpers\resetLocalStorage.ts: Unexpected token, expected "," (6:47)

 4 | import { HTTPRequest } from 'puppeteer';
 5 |
> 6 | export const resetLocalStorage = async (browser: BrowserContext, url: string): Promise<void> => {
   |                                                                                 ^
 7 |   const page = await browser.newPage();
 8 |   await page.setRequestInterception(true);
 9 |   page.on('request', (req) => { 

can someone please help me with this?

Vignesh-527 avatar Mar 18 '24 13:03 Vignesh-527