When trying to launch Visual Studio Code in debugging mode, to inspect a k6 testing script, I get the following message:
Uncaught Error: Cannot find module ‘k6’.
I’m writing the test scripts in TypeScript and I’m using NodeJS + Webpack + Babel. The .js file I pass to k6 is the bundle file created by Webpack.
My launch.json file looks like this:
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Launch Program”,
“type”: “node”,
“request”: “launch”,
“cwd”: “{workspaceFolder}", "protocol": "inspector", "preLaunchTask": "npm: build", "program": "{workspaceFolder}/src/Main.ts”,
“outFiles”: [
“${workspaceFolder}/dist/Main.js”
],
“sourceMaps”: true
}
]
I’ve also added this to the tsconfig.json:
“sourceMap”: true
There is this import in my script:
import { Options } from ‘k6/options’;
Please, can anyone help? How can I configure it so that I can debug k6 testing scripts in Visual Studio Code?