lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 136 forks source link

Debug original function invoked by spec #119

Closed masimplo closed 8 years ago

masimplo commented 8 years ago

Hi,

not sure if this has been answered before, but couldn't find anything related. I am trying to debug why a test fails and although using npm run karma and opening a second tab with debug as per instructions gives me the ability to add break points to the spec code, the code to be tests is minified and I cannot place a break point there. Debugging the actual test code is only half the story. Am I missing something?

screenshot 2016-07-11 16 21 42

I also clicked on the notification about pretty printing the minified file, which made no difference

lathonez commented 8 years ago

No, you're right. Apparently I've not had to dig this far before. It's exactly as you say.

The (source) source map works with npm start so hopefully we're just missing some config.

lathonez commented 8 years ago

It's the transform that breaks it for some reason, these lines here:

https://github.com/lathonez/clicker/blob/master/test/karma.config.js#L39-L44

My plan is to:

lathonez commented 8 years ago

I didn't end up removing the sourcemaps from npm test in the end. I didn't notice much difference in transpile time and they do give (more) useful traces when things go wrong.

Removing the transform from debug mode has solved the issue for me:

screenshot-20160712102810-1118x618

masimplo commented 8 years ago

Awesome, just tried it and it works great. Thanks for the quick resolution.

lathonez commented 8 years ago

No worries thanks for raising!