3

I am debugging third party library unit test. Test case is running using tape and tape-run. It is using below command to run test cases.

"test": "browserify -x react-native -x react/addons -x react/lib/ReactContext -x react/lib/ExecutionEnvironment test/index.js -t [ babelify --presets [ es2015 react ] --plugins [ transform-decorators-legacy transform-class-properties ] ] | tape-run | tap-spec"

I want to put breakpoint in vscode to debug particular test file. Do I need to use node debug along with above command to put breakpoint in vs code?

Priyesh Tiwari
  • 331
  • 1
  • 3
  • 13

1 Answers1

3

Just put this in launch.json, and open the test specs you want to run, then hit F5. The "Program" property is the tape executable in node_modules, while ${file} passed in args is the current file you are watching in vsCode. The "console" property is used to log the test result to the vscode internalConsole.

{
        "type": "node",
        "request": "launch",
        "name": "Tape Current File",
        "program": "${workspaceFolder}\\node_modules\\tape\\bin\\tape",
        "args": [
            "${file}"
        ],
        "console": "internalConsole"
}
MatteoPHRE
  • 358
  • 4
  • 10
  • While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – Stamos Jan 18 '19 at 16:34