0

I have a test-suit and a class under test, both are written in TypeScript. I am in a node-project and I run the Jest-Test from WebStorm in Debug-Mode. When I set a break point in the test WebStorm stopps exactly where I want. But when I step into the class under test the debugger jumps to the last line of it's .ts file. In the debug view I see that the linenumbers doesn't correspond to the ts-file. I seems like the source-mapping doesn't work for my class under test.

Q: How to fix the source-mapping?

The project structure is a follows:

project-root
  /projects/my-node-project/src
      /services         //here is the production code
      /specs            //here are the test-suits

enter image description here

1 Answer 1

2

Please check your jest.config.js - what does it look like? Do you have collectCoverage enabled in it? If the source file is instrumented for coverage, the generated code can't be correctly mapped to source; it's a well known limitation (not specific to WebStorm,BTW)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that solves the problem! Do you know of an option/way in WebStorm to override collectCoverage for launch-configurations that where started in Debug mode?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.