source: trip-planner-front/node_modules/karma-source-map-support/readme.md

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.2 KB
Line 
1# karma-source-map-support
2
3[![Greenkeeper badge](https://badges.greenkeeper.io/tschaub/karma-source-map-support.svg)](https://greenkeeper.io/)
4
5Karma plugin for inline sourcemap support.
6
7## Motivation
8
9When loading Browserify bundles with inline source maps (via [`karma-browserify`](https://www.npmjs.com/package/karma-browserify)), the stack traces in Chrome don't mention the original modules. This plugin uses [`source-map-support`](https://www.npmjs.com/package/source-map-support) to improve the situation.
10
11## Use
12
13Install the plugin with `npm`:
14
15 npm install karma-source-map-support
16
17Configure Karma to load the plugin as a framework:
18
19```js
20module.exports = function(config) {
21 config.set({
22 frameworks: ['source-map-support']
23 // additional settings here ...
24 });
25};
26```
27
28## Example
29
30The config settings below are a complete example using Mocha and Browserify with source map support:
31
32```js
33module.exports = function(config) {
34 config.set({
35 frameworks: ['browserify', 'source-map-support', 'mocha'],
36 files: [
37 'src/**/*.test.js'
38 ],
39 preprocessors: {
40 'src/**/*.test.js': ['browserify']
41 },
42 browsers: ['PhantomJS'],
43 singleRun: false,
44 browserify: {
45 debug: true // include inline source maps
46 }
47 });
48};
49```
50
51Sample stack trace without this plugin:
52```
53AssertionError: case 2: expected [ 0, 0.6666666666666666 ] to deeply equal [ 0, 0.5 ]
54 at Function.assert.deepEqual (http://localhost:9876/absolute/var/folders/6m/3grlt52x7w3047wy0n6j7dr00000gn/T/2d4c510ad9122153a42db199d1cc8e9553208184.browserify:1848:32)
55 at Context.<anonymous> (http://localhost:9876/absolute/var/folders/6m/3grlt52x7w3047wy0n6j7dr00000gn/T/2d4c510ad9122153a42db199d1cc8e9553208184.browserify:6061:14)
56 at callFn (http://localhost:9876/base/node_modules/mocha/mocha.js:4496:21)
57 at Test.Runnable.run (http://localhost:9876/base/node_modules/mocha/mocha.js:4489:7)
58 at Runner.runTest (http://localhost:9876/base/node_modules/mocha/mocha.js:4892:10)
59 at http://localhost:9876/base/node_modules/mocha/mocha.js:4970:12
60 at next (http://localhost:9876/base/node_modules/mocha/mocha.js:4817:14)
61 at http://localhost:9876/base/node_modules/mocha/mocha.js:4827:7
62 at next (http://localhost:9876/base/node_modules/mocha/mocha.js:4766:23)
63 at http://localhost:9876/base/node_modules/mocha/mocha.js:4794:5
64```
65
66
67Sample stack trace with this plugin:
68```
69AssertionError: case 2: expected [ 0, 0.6666666666666666 ] to deeply equal [ 0, 0.5 ]
70 at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:205:1)
71 at Context.<anonymous> (src/scenes/util/geom.test.js:27:1)
72 at callFn (http://localhost:9876/base/node_modules/mocha/mocha.js:4496:21)
73 at Test.Runnable.run (http://localhost:9876/base/node_modules/mocha/mocha.js:4489:7)
74 at Runner.runTest (http://localhost:9876/base/node_modules/mocha/mocha.js:4892:10)
75 at http://localhost:9876/base/node_modules/mocha/mocha.js:4970:12
76 at next (http://localhost:9876/base/node_modules/mocha/mocha.js:4817:14)
77 at http://localhost:9876/base/node_modules/mocha/mocha.js:4827:7
78 at next (http://localhost:9876/base/node_modules/mocha/mocha.js:4766:23)
79 at http://localhost:9876/base/node_modules/mocha/mocha.js:4794:5
80```
Note: See TracBrowser for help on using the repository browser.