PatrickJS-starter icon indicating copy to clipboard operation
PatrickJS-starter copied to clipboard

Unit Test Sourcemap Missing

Open adstep opened this issue 9 years ago • 13 comments

I'm submitting a... [*] bug report [ ] feature request [ ] question about the decisions made in the repository

What is the current behavior?

Sourcemapped files aren't being served when debugging unit tests.

  1. Run npm run watch:test
  2. Open Karma in Chrome
  3. Open debugger tools.
  4. Files are missing from the sources tab.

adstep avatar Jan 18 '17 22:01 adstep

@adstep did you resolve this? I'm having the same issue. Breakpoints are hit but i can only debug the compiled JS file. See screenshot, i haven't changed anything after downloading the master clone image

Aaltuj avatar Jan 26 '17 09:01 Aaltuj

No, I am still seeing this issue.

adstep avatar Jan 26 '17 19:01 adstep

We face the same issue and couldn't find a working solution so far:

  • no correct sourcemaps
  • no way to actually debug the unit tests from the IDE..

dsebastien avatar Jan 27 '17 08:01 dsebastien

@dsebastien you also lack sourcemaps when running npm run watch:dev? Because i only mis them during npm run test

Aaltuj avatar Jan 28 '17 06:01 Aaltuj

Anyone figure out a workaround?

adstep avatar Feb 05 '17 07:02 adstep

No still no progress on my end

Aaltuj avatar Feb 06 '17 10:02 Aaltuj

The issue is with the istanbul-instrumenter-loader plugin. See this example to conditionally load when not running in 'auto-watch'. http://stackoverflow.com/questions/39131809/karma-webpack-sourcemaps-not-working

greglarson avatar Feb 07 '17 20:02 greglarson

@greglarson is right. At work we have duplicated the webpack test and karma configs to have one for developers without any code instrumentation (Istanbul, coverage) and another one for our CI and Sonar.

It works and now we're able to debug our tests in IntelliJ/Webstorm and Chrome.

dsebastien avatar Feb 08 '17 06:02 dsebastien

For the completeness i will explain what i've done. For a project i've used a webpack-starter version from around october last year. There the unit-test are minimized and not readable. I have tried that already. This will only resolve the code to be readable and debuggable JS compiled from TS. The issue still remains with a new version of the webpack-starter only now i don't have to disable the istanbul coverage to see readable and debuggable JS compiled from TS

Aaltuj avatar Feb 08 '17 09:02 Aaltuj

I still see compiled ts code not minimised in devtools even with istanbul-instrumenter-loader commented out. When it it is not commented out I can see that the coverage produced is correct. The html correctly navigates me to typescript code where I can see something is not tested.

talamaska avatar Jul 03 '17 16:07 talamaska

does this mean that it won't be fixed somehow? It seems that I just disabled some stuff and now I can see TS in dev tools, I thing it's the coverage stuff

talamaska avatar Sep 02 '17 14:09 talamaska

@talamaska can you make a PR? I was closing issues because I plan on doing a huge refactor of the repo

PatrickJS avatar Sep 02 '17 15:09 PatrickJS

I applied the logic from angular2-webpack-starter

talamaska avatar Sep 03 '17 09:09 talamaska