rprieto / mocha-steps

Sequential scenarios for mocha
73 stars 17 forks source link

Error "step is not defined' when debugging in Visual studio code #27

Open nathalok opened 5 years ago

nathalok commented 5 years ago

When I tried to debug a mocha test in Visual Studio Code its throwing the following error - ReferenceError: step is not defined

Below is the copy of my launch.json file used for debug configuration and that should reproduce the error

Launch.json

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [

    {
        "type": "node",
        "request": "launch",
        //"skipFiles": [
          //  "<node_internals>/**"
          //],
        "name": "Mocha Tests",            
        "program": "${workspaceRoot}/node_modules/mocha/bin/mocha",
        "args": [                                
            "${workspaceFolder}/test/MyTests/sampleTest.js",                                
            "--require mocha-steps"
        ],
        "port": 9229,
        "internalConsoleOptions": "openOnSessionStart",
        "env": {
            // Used to select the config file from config folder. 
            // It should be same as the file name.
            "NODE_ENV": "dev"                 
        }
    }        
]

}


Visual Studio Code and Nodejs version details -

VSCode

jameswest368 commented 11 months ago

Had the same thing, need to split the args into separate strings otherwise strings with spaces are wrapped in double quotes.

"args": [                                
   "${workspaceFolder}/test/MyTests/sampleTest.js",                                
   "--require",
   "mocha-steps"
],