When debugging Jest tests in VS-Code my breakpoints move a few lines as soon as I start the debugger.
I use the officially recommended configuration with plain JavaScript (not Babel).
I think it has something to do with source maps.
Setting "sourceMaps": false in the configuration makes my breakpoints not move anymore but shift the 'real' source code a few lines.
Minimal Example:
// hello_world.test.js
funTest = require('./hello_world.js')
const x = 15
test('this is a test', () => {
expect(funTest(5)).toBe(9)
})
// hello_world.js
const funTest = () => {
return 9
}
module.exports= funTest
Now if you set a breakpoint at const x = 15 you will see that it is shifted to expect(funTest(5)).toBe(9) during the debugging session.
Used Software VS Code: 1.27.0, no extensions ; Jest: 23.5.0 ; Node: 8.10.0 ; Ubuntu Linux 16.04