在VS Code中调试Jest测试时,我的断点会在启动调试器后立即移动几行.
我用的是官方推荐的配置,如所描述这里与普通的JavaScript(不通天).
我认为这与源地图有关.配置"sourceMaps": false中的设置使我的断点不再移动,而是将"真实"源代码移动几行.
任何提示都非常感谢!
非常感谢您的帮助和最好的问候
阿诺
//二手软件
VS代码:1.27.0,没有扩展名
开玩笑:23.5.0
节点:8.10.0
Ubuntu Linux 16.04
最小例子:
//hello_world.test.js
// hello_world.test.js
funTest = require('./hello_world.js')
const x = 15
test('this is a test', () => {
    expect(funTest(5)).toBe(9)
})
Run Code Online (Sandbox Code Playgroud)
// hello_world.js
// hello_world.js
const funTest = () => {
    return 9 
}
module.exports= funTest
Run Code Online (Sandbox Code Playgroud)
现在,如果您设置断点,const x = 15您将看到它expect(funTest(5)).toBe(9)在调试会话期间转移到了.