Reputation: 25
Description: I'm working on a project using TypeScript and Playwright, and I'm writing tests with Cucumber.js. I can successfully run the tests from the terminal using the script defined in my package.json:
"scripts": {
"test:cucumber": "npx cucumber-js --config src/config/cucumber.js src/features"
}
When I run npm run test:cucumber, everything works fine.
However, I want to run and debug my tests from the Testing tab in Visual Studio Code. I've searched for extensions and tried ones like CucumberJS Test Runner and Cucumber JS Test Runner, but I've had issues configuring them properly.
I couldn't find official documentation on how to set up the Testing tab to read from my cucumber.js configuration file.
Does anyone know how to configure the Testing tab in VS Code to work with my existing Cucumber.js setup? How can I set it up to run and debug tests directly from VS Code Test tab?
Additional Information: Technologies Used: TypeScript, Playwright, Cucumber.js, I already have Test Explorer UI extension as well as Cucumber extension.
Project Structure:
project-root/
├── src/
│ ├── features/
│ │ └── *.feature
│ ├── steps/
│ │ └── *.ts
│ └── config/
│ └── cucumber.js
├── package.json
├── tsconfig.json
Package.json installed:
"devDependencies": {
"@cucumber/cucumber": "^11.1.0",
"@playwright/test": "^1.49.0",
"@types/node": "^22.9.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
}
What I've Tried: Installed extensions like CucumberJS Test Runner and Cucumber JS Test Runner but faced configuration issues. Searched official documentation and forums but couldn't find a solution tailored to my setup (TypeScript + Playwright + Cucumber.js).
my current settings.json includes so far only cucumber.features and cucumber.glue sections:
"cucumber.glue": [
"src/steps/*.ts"
],
"cucumber_runner.features": [
"src/features/**/*.feature",
],
Question: Is there a way to configure Visual Studio Code so that the Testing tab recognizes and runs my Cucumber.js tests using my existing cucumber.js configuration? If so, how can I achieve this?
Any guidance, configuration examples, or extension recommendations that could help me resolve this issue would be greatly appreciated.
Upvotes: 0
Views: 90