2

I'm trying to set up a tasks.json in VSCode to start a Maven task with Cucumber Test in debug mode. The task uses an input of type promptString to ask the user for a working directory of the features. If I enter a valid path (e.g., "src/features/sorting.feature"), it works fine. But when I leave it blank (hoping to use the default value specified in the input to run all the feature files), the task fails with this error:

The task 'Start Maven in Debug Mode' has not exited and doesn't have a 'problemMatcher' defined. Make sure to define a problem matcher for watch tasks.

Here's my tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Start Maven in Debug Mode",
      "type": "shell",
      "command": "mvn -Dmaven.surefire.debug test -Dcucumber.features=${input:featurePath}",
      "isBackground": true,
      "problemMatcher": {
        "owner": "java",
        "pattern": [
          {
            "regexp": ".*",
            "file": 1,
            "location": 2,
            "message": 3
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": ".*",
          "endsPattern": "Listening for transport dt_socket at address: 5005"
        }
      },
      "presentation": {
        "reveal": "always",
        "panel": "shared"
      }
    }
  ],
  "inputs": [
    {
      "id": "featurePath",
      "type": "promptString",
      "description": "Enter path to the feature file",
      "default": ""
    }
  ]
}

Expected behaviour: If I hit enter without typing anything in the input prompt, I expect the task to use the default value (which is blank).

Actual behaviour: It seems like VSCode is treating the blank as an empty string, not falling back to the default. Then the task fails because it's trying to run from an empty working directory.

Questions:

Is this the intended behaviour?

Is there a workaround to make the default value apply when the user hits enter without entering anything?

Should I be handling this with a different input type or maybe a custom script?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.