我在调试笑话测试时遇到了麻烦。也许我先介绍一下我的设置:
root-dir
test
sample.spec.ts
jest.config.js
package.json
tsconfig.json
Run Code Online (Sandbox Code Playgroud)
内容sample.spec.ts:
describe('Sample', () => {
it.concurrent('App', async () => {
expect(true).toEqual(true); // here the breakpoint is set
});
Run Code Online (Sandbox Code Playgroud)
});
所以这里没有什么需要调试的。我在 VS Code 中安装了Jest Runner扩展。
但是,当我“单击”正上方的“调试”按钮时it,调试器启动,但显示异常:
Exception has occurred: Error: Cannot find module 'jest-environment-<path-to-my-root-dir>\node_modules\jest-environment-node\build\index.js/package.json' from '<path-to-my-root-dir>'e
Run Code Online (Sandbox Code Playgroud)
那里有什么问题呢?在node_modules目录中,jest-environment-node有 。异常的路径不正确,因此找不到package.json. 但这件事我无法影响!
我感谢您的帮助!
向大家致以亲切的问候!