Balrog994 / cucumber-test-runner

An Extension for Visual Studio Code to Run and Debug CucumberJS Tests
MIT License
5 stars 8 forks source link

Struggling to use breakpoints in Test Explorer #14

Open hardymj opened 1 year ago

hardymj commented 1 year ago

I've created a very basic test.

image

The test

@Test @Examples Feature: Test Examples

Background:Before Test Scenarios Scenario:2 This is a Test When I do something

The steps.js file just prints out a number to a console.

const {Given, When, Before, After, setDefaultTimeout, Status} = require('@cucumber/cucumber'); setDefaultTimeout(60 * 1000); Given('I do something', async function() { await new Promise(resolve => setTimeout(resolve, 5000)); await console.log("1"); });

When i go to click on the Debug option within Test Explorer, it runs the test even though there are breakpoints in the Steps file.

Within the cucumber.js file i have the following.

module.exports = { default: { ...common, }, cli: { ...common, paths: ['journeys///*.feature'], }, };

I've created a launch.json file and this does run in stop at breakpoints { "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Debug Cucumber Tests", "program": "node_modules/@cucumber/cucumber/bin/cucumber-js", "args": [ "--require", "features/support/*.js", "features" ], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } ] }

image

Any ideas how to get the Button within Visual Studio Code to use breakpoints?

hardymj commented 1 year ago

This code change enables breakpoints to work for me https://github.com/hardymj/cucumber-test-runner/tree/enableBreakpointsInDebugMode

Balrog994 commented 1 year ago

Hey @hardymj

thanks again for the feedback, I've done some tests to find the cause of this problem and I was able to reproduce your problem only when not using ts-node as a runner. I'll take a look to your change and see if it works for ts-node too, otherwise I need to find a solution that works for both.

hardymj commented 1 year ago

Hey @hardymj

thanks again for the feedback, I've done some tests to find the cause of this problem and I was able to reproduce your problem only when not using ts-node as a runner. I'll take a look to your change and see if it works for ts-node too, otherwise I need to find a solution that works for both.

thanks

hardymj commented 1 year ago

I think there is some extra work needed on this change. It does not use the config settings within the settings.json or cucumber.js for some reason

hardymj commented 10 months ago

Hi, Did you chance to find a change that would work when not using ts-node as a runner?

Hey @hardymj

thanks again for the feedback, I've done some tests to find the cause of this problem and I was able to reproduce your problem only when not using ts-node as a runner. I'll take a look to your change and see if it works for ts-node too, otherwise I need to find a solution that works for both.