When I run my unit test cases using Jasmine/Karma and debug the application in Google Chrome, when I set breakpoints and step through the application, the line numbers the application stops on are visually wrong. Additionally, the lines mentioned in the Karma Chrome window debugger are also wrong.
Example: when the following error occurs in Karma Debugger in chrome, PartyComponent.showPartyDetails
actually gets called on line 280. line 309 belongs to an unrelated method in the same class.
PartyComponent > should add party
TypeError: Cannot read properties of undefined (reading 'configureData')
at <Jasmine>
at PartyComponent.showPartyDetails (http://localhost:9876/_karma_webpack_/src/app/pages/secure/common-modules/party/party/party.component.ts:309:12)
at SafeSubscriber._next (http://localhost:9876/_karma_webpack_/main.js:41046:12)
at SafeSubscriber.__tryOrUnsub (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Subscriber.js:183:1)
at SafeSubscriber.next (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Subscriber.js:122:1)
at Subscriber._next (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Subscriber.js:72:1)
at Subscriber.next (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Subscriber.js:49:1)
at TakeSubscriber._next (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/operators/take.js:35:1)
at TakeSubscriber.next (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Subscriber.js:49:1)
at Notification.observe (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/Notification.js:20:1)
at AsyncAction.dispatch (http://localhost:9876/_karma_webpack_/node_modules/rxjs/_esm2015/internal/operators/delay.js:34:1)
The application call stack seems to be calling the correct methods, When I disable JavaScript source maps in Chrome, I am able to get to the correct line numbers.
I am not sure why this is occurring, or why the source map seems to have gotten corrupted as this was previously working.
Is there a way to rebuild the JavaScript source maps? Or is there a way to fix this issue so that the line numbers in the debugger match the actual code? Browsing online I found answers from several years ago that didn't quite help me. I am new to source maps and debugging, so a description of how these things work would be really helpful.
karma.conf.js: https://pastebin.com/J5GqeVVs tsconfig.json: https://pastebin.com/dMnQ27P5