I was able to get debugging Visual Studio typescript jasmine tests working in karma working. Wow, this is a sip.
Here is how I did it:
- In IE options, Advanced: uncheck the "Disable script debugging (Internet Explorer)" box.
- Install the node modules (globally) needed to run karma - if you haven't done it yet:
npm install -g karma karma-chrome-launcher karma-ie-launcher jasmine-core karma-jasmine karma-jasmine-html-reporter npm install -g phantomjs karma-phantomjs-launcher
- In
karma.conf.js add support for serving the necessary sourcemap and typescript files. Here's mine:
module.exports = function(config) { config.set({ frameworks: ['jasmine'], files: [ 'bower_components/angular/angular.js', 'bower_components/angular-mocks/angular-mocks.js', 'dist/**/*.js', 'test/out/**/*.js',
- After compiling your typescript, start karma by running IE:
karma start
- Visual Studio Debugging Menu | Attach to the process ..., then select the iexplore.exe instance that looks correct - for example, the title may correspond to the title of the Karma web page ("Karma DEBUG RUNNER" at present), and the process type should be "Script". If typescript debugging does not work, try adding multiple instances of iexplore.exe, including all possible instances of the script.
After that, you should see the βScript Documentsβ folder in Solution Explorer, and you can place breakpoints in your typescript, run tests in your browser and execute your typescript code.
It turns out that all these steps also work for debugging typescript tests and code in Chrome - just change step 4 to:
karma start
(skip step 5), then open the Chrome developer tools to debug typescript in chrome.
source share