Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 使用源代码映射支持调试jest_Unit Testing_Jestjs_Babeljs - Fatal编程技术网

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
    for
    jest
  • 在我的preprocess.js文件中
  • 但这不起作用。有什么想法吗

    
    
        "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;
        }