Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I add source-map support? #3736

Closed
bchenSyd opened this issue Jun 4, 2017 · 3 comments
Closed

how can I add source-map support? #3736

bchenSyd opened this issue Jun 4, 2017 · 3 comments

Comments

@bchenSyd
Copy link
Contributor

bchenSyd commented Jun 4, 2017

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`
 "transform": {
      ".*": "<rootDir>/scripts/jest/preprocessor.js"
    }

2. 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?

@cpojer
Copy link
Member

cpojer commented Jun 4, 2017

Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions. Thank you :)

@cpojer cpojer closed this as completed Jun 4, 2017
@bchenSyd
Copy link
Contributor Author

bchenSyd commented Jun 5, 2017

@cpojer I finally get it to work. will create a PR for jest

image

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants