[英]Debugging Tests With Create React App using Typescript in VSCode or Chrome
Created an app using ( https://github.com/Microsoft/TypeScript-React-Starter )使用( https://github.com/Microsoft/TypeScript-React-Starter )创建了一个应用程序
npm install -g create-react-app npm install -g create-react-app
create-react-app my-app --scripts-version=react-scripts-ts create-react-app my-app --scripts-version=react-scripts-ts
I've gone through a number of articles, seem to be going around in circles, but have not yet found how i can debug the default app.test.tsx我已经阅读了许多文章,似乎在兜圈子,但还没有找到如何调试默认的 app.test.tsx
Node is on version 7.9.0 Everything else should be on the latest version. Node 的版本是 7.9.0 其他所有东西都应该是最新版本。
This has been fixed now.现在已经修复了。 https://github.com/Microsoft/TypeScript-React-Starter/issues/46 https://github.com/Microsoft/TypeScript-React-Starter/issues/46
Install Node v8.5安装节点 v8.5
Update to the latest version of Create-React-App (or update the react-scripts-ts to 2.7)更新到最新版本的 Create-React-App(或更新 react-scripts-ts 到 2.7)
Configure vscode debugger with配置 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 -->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.