vscode在子文件夹中启动开玩笑测试
我正在一个具有jest.config.js
和package.json
文件的monorepo中,在该monorepo中代表独立项目的 package.json
items/thing/
items/other/
items/something/
焦点中的测试文件,然后我可以使用此配置项目在items/thing/
文件夹中运行该测试文件。
"name": "Jest (this file)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/items/thing",
"runtimeArgs": [
"--inspect-brk",
"${workspaceFolder}/node_modules/.bin/jest",
"${relativeFile}"
],
但是,要在项目/其他/
文件夹中执行相同的操作,我需要将cwd
属性更改为该值。
有没有办法将cwd
与具有配置/软件包文件的最接近的父母“联系” ? (还是解决这个问题的另一种方法?)
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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论