scala-js/scala-js — pull request #981 by lihaoyi (2014-08-28 08:16:18+00:00)
Title: Added auto-generated tests for source maps.

I've spent some time trying to reproduce some confusing/incorrect source maps I was getting in the browser. I failed to reproduce them, but ended up with a pretty neat automated test suite for the source-map-generation, which involves generating 100 versions of my Scala.js JSON parser with `throw new Exception("n")` inserted in various places, and seeing that the line it inserted the exception is the same line which the source map points at.

To run, you need to

```
npm install source-map-support
sbt package ~sourceMapTests/fastOptStage::test
```

Is there any interest in merging this/putting it into CI? I imagine it probably is much more thorough than the manual testing we're doing before releases, and could help detect bugs earlier and more reliably. It inserts the `throw`s in all sorts of odd places in the source code, such as class-bodies, inner-functions, inner-inner-functions, before/after other code snippets on the same line, etc..

Adding new spots is as simple as placing `/**/` in the right place, and it'll get picked up by the source generator automatically. It should also be pretty easy to set up to test under full optimization (probably just need to swap it to `fullOptStage`) now that that works.