debug jest with source-map support

Viewed 1019

I'm using jest with babel and i want to debug my test. I'm able to debug jest with node --debug-brk ./node_modules/.bin/jest --runInBand [any other arguments here] but lose all es6 source code info. I know source-map-support is a babel feature not jest's, but jest should somehow tell babel to include source-map-support.

so far I've tried

  1. config transform for jest


    "transform": {
           ".*": "/scripts/jest/preprocessor.js"
    }

  1. in my preprocess.js file I have


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

but this doesn't work. any ideas?

0 Answers
Related