\href{https://greenkeeper.io/}{\texttt{ }}

Karma plugin for inline sourcemap support.\hypertarget{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15767}{}\doxysection{Motivation}\label{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15767}
When loading Browserify bundles with inline source maps (via \href{https://www.npmjs.com/package/karma-browserify}{\texttt{ {\ttfamily karma-\/browserify}}}), the stack traces in Chrome don\textquotesingle{}t mention the original modules. This plugin uses \href{https://www.npmjs.com/package/source-map-support}{\texttt{ {\ttfamily source-\/map-\/support}}} to improve the situation.\hypertarget{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15768}{}\doxysection{Use}\label{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15768}
Install the plugin with {\ttfamily npm}\+: \begin{DoxyVerb}npm install karma-source-map-support
\end{DoxyVerb}
 Configure Karma to load the plugin as a framework\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = function(config) \{}
\DoxyCodeLine{  config.set(\{}
\DoxyCodeLine{    frameworks: ['source-\/map-\/support']}
\DoxyCodeLine{    // additional settings here ...}
\DoxyCodeLine{  \});}
\DoxyCodeLine{\}; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15769}{}\doxysection{Example}\label{md_sfcode_node_modules_karma_source_map_support_readme_autotoc_md15769}
The config settings below are a complete example using Mocha and Browserify with source map support\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{module.exports = function(config) \{}
\DoxyCodeLine{  config.set(\{}
\DoxyCodeLine{    frameworks: ['browserify', 'source-\/map-\/support', 'mocha'],}
\DoxyCodeLine{    files: [}
\DoxyCodeLine{      'src/**/*.test.js'}
\DoxyCodeLine{    ],}
\DoxyCodeLine{    preprocessors: \{}
\DoxyCodeLine{      'src/**/*.test.js': ['browserify']}
\DoxyCodeLine{    \},}
\DoxyCodeLine{    browsers: ['PhantomJS'],}
\DoxyCodeLine{    singleRun: false,}
\DoxyCodeLine{    browserify: \{}
\DoxyCodeLine{      debug: true // include inline source maps}
\DoxyCodeLine{    \}}
\DoxyCodeLine{  \});}
\DoxyCodeLine{\}; }

\end{DoxyCode}


Sample stack trace without this plugin\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{AssertionError: case 2: expected [ 0, 0.6666666666666666 ] to deeply equal [ 0, 0.5 ]}
\DoxyCodeLine{    at Function.assert.deepEqual (http://localhost:9876/absolute/var/folders/6m/3grlt52x7w3047wy0n6j7dr00000gn/T/2d4c510ad9122153a42db199d1cc8e9553208184.browserify:1848:32)}
\DoxyCodeLine{    at Context.<anonymous> (http://localhost:9876/absolute/var/folders/6m/3grlt52x7w3047wy0n6j7dr00000gn/T/2d4c510ad9122153a42db199d1cc8e9553208184.browserify:6061:14)}
\DoxyCodeLine{    at callFn (http://localhost:9876/base/node\_modules/mocha/mocha.js:4496:21)}
\DoxyCodeLine{    at Test.Runnable.run (http://localhost:9876/base/node\_modules/mocha/mocha.js:4489:7)}
\DoxyCodeLine{    at Runner.runTest (http://localhost:9876/base/node\_modules/mocha/mocha.js:4892:10)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4970:12}
\DoxyCodeLine{    at next (http://localhost:9876/base/node\_modules/mocha/mocha.js:4817:14)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4827:7}
\DoxyCodeLine{    at next (http://localhost:9876/base/node\_modules/mocha/mocha.js:4766:23)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4794:5 }

\end{DoxyCode}


Sample stack trace with this plugin\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{AssertionError: case 2: expected [ 0, 0.6666666666666666 ] to deeply equal [ 0, 0.5 ]}
\DoxyCodeLine{    at Function.assert.deepEqual (node\_modules/chai/lib/chai/interface/assert.js:205:1)}
\DoxyCodeLine{    at Context.<anonymous> (src/scenes/util/geom.test.js:27:1)}
\DoxyCodeLine{    at callFn (http://localhost:9876/base/node\_modules/mocha/mocha.js:4496:21)}
\DoxyCodeLine{    at Test.Runnable.run (http://localhost:9876/base/node\_modules/mocha/mocha.js:4489:7)}
\DoxyCodeLine{    at Runner.runTest (http://localhost:9876/base/node\_modules/mocha/mocha.js:4892:10)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4970:12}
\DoxyCodeLine{    at next (http://localhost:9876/base/node\_modules/mocha/mocha.js:4817:14)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4827:7}
\DoxyCodeLine{    at next (http://localhost:9876/base/node\_modules/mocha/mocha.js:4766:23)}
\DoxyCodeLine{    at http://localhost:9876/base/node\_modules/mocha/mocha.js:4794:5 }

\end{DoxyCode}
 