I am working in a monorepo that has jest.config.js and package.json files in subfolders that represent independent projects in this monorepo, example:
items/thing/
items/other/
items/something/
In VSCode, if I have a test file in focus, I can then use this config item to run that test file in the items/thing/ folder.
"name": "Jest (this file)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/items/thing",
"runtimeArgs": [
"--inspect-brk",
"${workspaceFolder}/node_modules/.bin/jest",
"${relativeFile}"
],
However, to do the same in the items/other/ folder I need to change the cwd property to that value.
Is there a way to "tie" the cwd to the closest parent that has the config/package files so I don't have to adjust the launch.json settings each time? (Or another way to solve this?)