My colleague who does not use VS Code had made a small typescript file to be run with every test. This could be run from the mocha command line by using the --file option. I attempted to put the --file option and args section in the .vscode/launch.json file but it seemed to get ignored.
After a lot of hair pulling I managed to get it working by using the --config option to point to a small .mocharc.js file that I put in .vscode folder to keep it out of the way. The .mocharc.js looked like this:
module.exports = {
file: ['./tests/testHelper.ts']
}
I put this here so either someone could post a better way, or someone might find it useful. The args section of launch.json looked like this:
"args": [
"-r",
"ts-node/register",
"--config", "${workspaceRoot}/.vscode/.mocharc.js",
"${relativeFile}",
"--no-timeout"
],