我正在尝试使用 chrome 开发工具来调试我的测试。我有一个使用 jest 的简单测试设置
describe('App component renders the todo correctly', () => {
it('renders correctly', () => {
const rendered = renderer.create(
<App />
);
expect(rendered.toJSON()).toMatchSnapshot();
});
});
使用:
"test": "node node_modules/jest/bin/jest.js --watch --silent",
我可以进
chrome://inspect/#devices然后点击
Open dedicated DevTools for Node
然而,在产生的
dev tools 中窗口,我看不到任何要调试的东西。我期待一个可以设置断点和检查数据的过程。
如何在
dev tools 中调试我的测试?
请您参考如下方法:
这可能会有所帮助:https://facebook.github.io/jest/docs/en/troubleshooting.html
本质上:添加 debug;在你的测试中声明。然后运行:node debug --debug-brk node_modules/jest/bin/jest.js -i




