[英]How to set up jest typescripts tests to run in debug mode using vscode
我按照https://github.com/Microsoft/TypeScript-React-Starter創建了一個 React 應用程序
是否有指南或鏈接提供簡單易用的設置來調試在 vscode 中用 jest 和酶編寫的測試? 我遇到了一些零碎的事情,到目前為止沒有任何工作。
對於最新的create-react-app
(2.1.5) 和react-scripts-ts
(3.1.0),在你的項目根目錄創建一個.vscode
目錄並添加以下launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug CRA Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts-ts",
"args": [
"test",
"--runInBand",
"--no-cache",
"--no-watch",
"--env=jsdom"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
然后使用Debug CRA Tests
配置啟動 VSCode 調試器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.