-1

I have an existing project set up so that npm run test runs all unit tests or npm run test [...files] will run specific files only.

I would like to set up vscode to work with this, but I am completely lost. There is launch.json and tasks.json and it's totally unclear what each do or how to set them up properly. It seems that launch.json configures the "Run and debug" menu, and tasks configures tasks that don't seem to appear anywhere except in the command palette??

Which is the correct one to use here?

Ideally I want a button to appear somewhere that I can just click to run the tests in the currently open test file. Is this possible?

I have heard that you can use ${file} for the currently open file, but I'm not sure if this is a real thing or whether it works in launch or tasks or both.

I have also heard that there is a default Ctrl-Shift-T shortcut for running a "test" task, but I have been unable to get this to work. Is this a real thing? If so how do you set it up?

SystemParadox
  • 8,203
  • 5
  • 49
  • 57

1 Answers1

0

If you have defined these npm run scripts in package.json (in the root of your workspace) you will get an NPM SCRIPTS view in the Explorer Bar

Just click the script you want

rioV8
  • 24,506
  • 3
  • 32
  • 49