在远程服务器中的Nestjs项目中的package.json文件,在scripts中添加或修改
"test:debug": "node --inspect-brk={IP:Port} -r tsconfig-paths/register -r ts-node/register node_modules/jest/bin/jest.js --runInBand",
在本地相同项目.vscode文件夹下,添加launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Remote server",
"request": "attach",
"address": "Remote Server IP",
"port": 9229,
"autoAttachChildProcesses": true,
"localRoot": "${workspaceFolder}",
"remoteRoot": "project absolute path",
"skipFiles": ["<node_internals>/**"],
"type": "node"
}
]
}
标签:node,Remote,VSCode,json,Nestjs,jest,远程,调试
From: https://www.cnblogs.com/Jeffrey-GG/p/17403362.html