{"action":"created","issue":{"url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/207","labels_url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/207/comments","events_url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/207/events","html_url":"https://github.com/nathanboktae/mocha-phantomjs/issues/207","id":108962829,"number":207,"title":"Support for source maps","user":{"login":"axelpale","id":992081,"avatar_url":"https://avatars.githubusercontent.com/u/992081?v=3","gravatar_id":"","url":"https://api.github.com/users/axelpale","html_url":"https://github.com/axelpale","followers_url":"https://api.github.com/users/axelpale/followers","following_url":"https://api.github.com/users/axelpale/following{/other_user}","gists_url":"https://api.github.com/users/axelpale/gists{/gist_id}","starred_url":"https://api.github.com/users/axelpale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axelpale/subscriptions","organizations_url":"https://api.github.com/users/axelpale/orgs","repos_url":"https://api.github.com/users/axelpale/repos","events_url":"https://api.github.com/users/axelpale/events{/privacy}","received_events_url":"https://api.github.com/users/axelpale/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-29T21:22:40Z","updated_at":"2015-09-29T21:32:34Z","closed_at":null,"body":"Please correct me if I'm missing something but:\r\n\r\nThe default reporter seems not to understand source maps. If a bundled and minified script is tested, and a test fails, the displayed line number points to the bundled and minified script even when the script includes a link to the source maps or has inline source maps.\r\n\r\nFor example, a script `taaspace.min.js` is bundled from about eight files and minified by using [Browserify](http://browserify.org/) and [Minifyify](https://www.npmjs.com/package/minifyify). The details are not important but this is how it is done:\r\n\r\n    $ browserify --debug --standalone taaspace src/index.js -p [minifyify --map taaspace.map.json --output taaspace.map.json] > taaspace.min.js\r\n\r\nUnit tests are run by:\r\n\r\n    $ mocha-phantomjs tests/testrunner.html\r\n\r\nThe report includes:\r\n\r\n    1 passing (11ms)\r\n    2 failing\r\n    \r\n    1) taaspace Taa should fire load event:\r\n        ReferenceError: Can't find variable: img\r\n        at file:///Users/xeli/workspace/taaspace/taaspace.min.js:20\r\n        at file:///Users/xeli/workspace/taaspace/tests/taaspace.phantom.js:12\r\n\r\nAs can be seen from the penultimate line, the bundle is referenced, instead of the actual source file (named src/Taa.js). This makes the stack trace quite useless for the developer.\r\n\r\nA [dirty hack](https://gist.github.com/asheb/8f67d55ef597329d266e) already exists but it is just a dirty hack.\r\n\r\nThe [source-map-support](https://github.com/evanw/node-source-map-support) library could provide some help but it does not seem to have any effect. It can be included in the testrunner.html:\r\n\r\n    <script src=\"browser-source-map-support.js\"</script>\r\n    <script>sourceMapSupport.install();</script>"},"comment":{"url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/comments/144197491","html_url":"https://github.com/nathanboktae/mocha-phantomjs/issues/207#issuecomment-144197491","issue_url":"https://api.github.com/repos/nathanboktae/mocha-phantomjs/issues/207","id":144197491,"user":{"login":"axelpale","id":992081,"avatar_url":"https://avatars.githubusercontent.com/u/992081?v=3","gravatar_id":"","url":"https://api.github.com/users/axelpale","html_url":"https://github.com/axelpale","followers_url":"https://api.github.com/users/axelpale/followers","following_url":"https://api.github.com/users/axelpale/following{/other_user}","gists_url":"https://api.github.com/users/axelpale/gists{/gist_id}","starred_url":"https://api.github.com/users/axelpale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axelpale/subscriptions","organizations_url":"https://api.github.com/users/axelpale/orgs","repos_url":"https://api.github.com/users/axelpale/repos","events_url":"https://api.github.com/users/axelpale/events{/privacy}","received_events_url":"https://api.github.com/users/axelpale/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T21:32:34Z","updated_at":"2015-09-29T21:32:34Z","body":"If needed, here is the devDependencies of taaspace.js:\r\n\r\n    \"devDependencies\": {\r\n      \"jshint\": \"^2.8.0\",\r\n      \"mocha\": \"^2.3.3\",\r\n      \"browserify\": \"^11.2.0\",\r\n      \"mocha-phantomjs\": \"^4.0.1\",\r\n      \"phantomjs\": \"^1.9.18\",\r\n      \"chai\": \"^3.3.0\",\r\n      \"chai-jquery\": \"^2.0.0\",\r\n      \"jquery\": \"^2.1.4\",\r\n      \"minifyify\": \"^7.1.0\"\r\n    },"}}