Unit testing 使用源代码映射支持调试jest
我正在将Unit testing 使用源代码映射支持调试jest,unit-testing,jestjs,babeljs,Unit Testing,Jestjs,Babeljs,我正在将jest与babel一起使用,我想调试我的测试。 我可以使用节点调试jest--debug brk./node\u modules/.bin/jest--runInBand[此处的任何其他参数]但会丢失所有es6源代码信息。 我知道sourcemap support是一个babel功能,不是jest的,但是jest应该告诉babel包括源代码映射支持 到目前为止我已经试过了 配置transformforjest 在我的preprocess.js文件中 但这不起作用。有什么想法吗
jest
与babel
一起使用,我想调试我的测试。
我可以使用节点调试jest--debug brk./node\u modules/.bin/jest--runInBand[此处的任何其他参数]
但会丢失所有es6源代码信息。
我知道sourcemap support
是一个babel
功能,不是jest的
,但是jest
应该告诉babel
包括源代码映射支持
到目前为止我已经试过了
transform
forjest
"transform": {
".*": "/scripts/jest/preprocessor.js"
}
const register=require("babel-register")
register();
....
module.exports = {
process: function(src, filename) {
const options = assign({}, babelOptions, {
filename: filename,
retainLines: true,
sourceMap:true, // I added this line
});
return babel.transform(src, options).code;
}