创建一个应用程序,使用(https:/github.comMicrosoftTypeScript-React-Starter。)
npm install -g create-react-app。
create-react-app my-app --scripts-version=react-scripts-ts。
我看了很多文章,似乎在兜圈子,但还没有找到如何调试默认的app.test.tsx。
Node是在7.9.0版本上其他的东西都应该是最新的版本。
现在这个问题已经解决了。https:/github.comMicrosoftTypeScript-React-Starterissues46。
安装Node v8.5
更新到最新版本的Create-React-App(或更新react-scripts-ts到2.7)。
配置vscode调试器
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug CRA Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts-ts",
"runtimeArgs": [
"--inspect-brk",
"test"
],
"args": [
"--runInBand",
"--no-cache",
"--env=jsdom"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
<!-- begin snippet: js hide: false console: true babel: false -->