jest 测试typescript,如果想对测试文件本身断点调试。
安装jest相关依赖
# jest本体
npm install --save-dev jest
# jest的类型声明
npm install --save-dev @types/jest
# typescript中使用
npm install --save-dev ts-jest
launch.json 配置参考
{
"type": "node",
"request": "launch",
"name": "test",
"runtimeExecutable": "npx",
"runtimeArgs": ["jest", "--runInBand", "${workspaceFolder}/test/index.test.ts"],
"protocol": "inspector"
}
网友评论